별조각픽업
This commit is contained in:
Binary file not shown.
46
Assets/02_Scripts/Managers/CollectionManager.cs
Normal file
46
Assets/02_Scripts/Managers/CollectionManager.cs
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class CollectionManager : MonoBehaviour
|
||||||
|
{
|
||||||
|
public static CollectionManager Instance;
|
||||||
|
|
||||||
|
[Header("Star Data")]
|
||||||
|
private int _currentStars = 0;
|
||||||
|
|
||||||
|
[Header("CollectionHuds")]
|
||||||
|
[SerializeField] private StarPieceHud _starPieceHud;
|
||||||
|
|
||||||
|
public int GetStarCount => _currentStars;
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (Instance != null && Instance != this)
|
||||||
|
{
|
||||||
|
Destroy(gameObject);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Instance = this;
|
||||||
|
DontDestroyOnLoad(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
UpdateUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddStar(int amount)
|
||||||
|
{
|
||||||
|
_currentStars += amount;
|
||||||
|
UpdateUI();
|
||||||
|
|
||||||
|
Debug.Log("Star Added: " + amount + " / Total Star: " + _currentStars);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UpdateUI()
|
||||||
|
{
|
||||||
|
if(_starPieceHud != null)
|
||||||
|
{
|
||||||
|
_starPieceHud.RefreshUI();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/02_Scripts/Managers/CollectionManager.cs.meta
Normal file
2
Assets/02_Scripts/Managers/CollectionManager.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 5246c040c89587145b3d5b6f6631a948
|
||||||
81
Assets/02_Scripts/Managers/StarPickup.cs
Normal file
81
Assets/02_Scripts/Managers/StarPickup.cs
Normal file
@@ -0,0 +1,81 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
public class StarPickup : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private string _playerTag;
|
||||||
|
|
||||||
|
[Header("Visual Spin")]
|
||||||
|
public Transform visualRoot;
|
||||||
|
public bool rotate = true;
|
||||||
|
public float rotateSpeed = 180f;
|
||||||
|
|
||||||
|
[Tooltip("회전축")]
|
||||||
|
public Vector3 rotateAxis = Vector3.up;
|
||||||
|
|
||||||
|
[Header("Float Motion")]
|
||||||
|
public bool floatMotion = true;
|
||||||
|
public float floatHeight = 0.08f;
|
||||||
|
public float floatSpeed = 2f;
|
||||||
|
|
||||||
|
[Header("Sound")]
|
||||||
|
public AudioClip pickupSound;
|
||||||
|
|
||||||
|
private Vector3 startPosition;
|
||||||
|
|
||||||
|
void Awake()
|
||||||
|
{
|
||||||
|
if (visualRoot == null)
|
||||||
|
{
|
||||||
|
visualRoot = transform;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Start()
|
||||||
|
{
|
||||||
|
startPosition = transform.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Update()
|
||||||
|
{
|
||||||
|
if (rotate && visualRoot != null)
|
||||||
|
{
|
||||||
|
visualRoot.Rotate(rotateAxis.normalized, rotateSpeed * Time.deltaTime, Space.Self);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (floatMotion)
|
||||||
|
{
|
||||||
|
float yOffset = Mathf.Sin(Time.time * floatSpeed) * floatHeight;
|
||||||
|
transform.position = startPosition + new Vector3(0f, yOffset, 0f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CollectStar()
|
||||||
|
{
|
||||||
|
|
||||||
|
Debug.Log("CollectStar called.");
|
||||||
|
|
||||||
|
if (CollectionManager.Instance != null)
|
||||||
|
{
|
||||||
|
CollectionManager.Instance.AddStar(1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Debug.LogWarning("CollectionManager not found.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pickupSound != null && pickupSound != null)
|
||||||
|
{
|
||||||
|
SoundManager.Instance.PlaySFX(pickupSound);
|
||||||
|
}
|
||||||
|
|
||||||
|
Destroy(gameObject);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnTriggerEnter(Collider other)
|
||||||
|
{
|
||||||
|
if(other.CompareTag(_playerTag))
|
||||||
|
{
|
||||||
|
CollectStar();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/02_Scripts/Managers/StarPickup.cs.meta
Normal file
2
Assets/02_Scripts/Managers/StarPickup.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 400203bf2ecfc114f91e0dc63fe1e219
|
||||||
31
Assets/02_Scripts/UI/StarPieceHud.cs
Normal file
31
Assets/02_Scripts/UI/StarPieceHud.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using TMPro;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.UI;
|
||||||
|
|
||||||
|
public class StarPieceHud : MonoBehaviour
|
||||||
|
{
|
||||||
|
[SerializeField] private Image[] _imageArray;
|
||||||
|
[SerializeField] private TMP_Text _countText;
|
||||||
|
|
||||||
|
[SerializeField] private GameObject _StarPieceUIRoot;
|
||||||
|
|
||||||
|
public int GetStarCount => CollectionManager.Instance.GetStarCount;
|
||||||
|
|
||||||
|
public void RefreshUI()
|
||||||
|
{
|
||||||
|
_countText.text = $"{GetStarCount} / {_imageArray.Length}";
|
||||||
|
|
||||||
|
for(int i = 0; i<_imageArray.Length; i++)
|
||||||
|
{
|
||||||
|
if(i < GetStarCount)
|
||||||
|
{
|
||||||
|
_imageArray[i].gameObject.SetActive(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StarPieceHudToggle()
|
||||||
|
{
|
||||||
|
_StarPieceUIRoot.SetActive(!_StarPieceUIRoot.activeSelf);
|
||||||
|
}
|
||||||
|
}
|
||||||
2
Assets/02_Scripts/UI/StarPieceHud.cs.meta
Normal file
2
Assets/02_Scripts/UI/StarPieceHud.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 1b4836d7a85fcc848b5a25b8a2e51a36
|
||||||
Binary file not shown.
BIN
Assets/04_Models/Objects/Star/Prefabs/star_piece.prefab
LFS
Normal file
BIN
Assets/04_Models/Objects/Star/Prefabs/star_piece.prefab
LFS
Normal file
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: a0d191b2a9fd35a4c853beafc12ccd57
|
guid: b1c15982e88ac314080aa85e24337300
|
||||||
PrefabImporter:
|
PrefabImporter:
|
||||||
externalObjects: {}
|
externalObjects: {}
|
||||||
userData:
|
userData:
|
||||||
BIN
Assets/05_Textures/UI/StarPieceIUIBase.png
LFS
Normal file
BIN
Assets/05_Textures/UI/StarPieceIUIBase.png
LFS
Normal file
Binary file not shown.
156
Assets/05_Textures/UI/StarPieceIUIBase.png.meta
Normal file
156
Assets/05_Textures/UI/StarPieceIUIBase.png.meta
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 32208240115105347883a410f0986dee
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 0
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 1
|
||||||
|
wrapV: 1
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 0
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 1
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 1
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 8
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Android
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: WebGL
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: WindowsStoreApps
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID: 5e97eb03825dee720800000000000000
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/11_Audio/Source/SFX/PickupStar.wav
LFS
Normal file
BIN
Assets/11_Audio/Source/SFX/PickupStar.wav
LFS
Normal file
Binary file not shown.
23
Assets/11_Audio/Source/SFX/PickupStar.wav.meta
Normal file
23
Assets/11_Audio/Source/SFX/PickupStar.wav.meta
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 0716d271725fed94aad4c2028810ab5f
|
||||||
|
AudioImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 8
|
||||||
|
defaultSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
loadType: 0
|
||||||
|
sampleRateSetting: 0
|
||||||
|
sampleRateOverride: 44100
|
||||||
|
compressionFormat: 1
|
||||||
|
quality: 1
|
||||||
|
conversionMode: 0
|
||||||
|
preloadAudioData: 0
|
||||||
|
platformSettingOverrides: {}
|
||||||
|
forceToMono: 0
|
||||||
|
normalize: 1
|
||||||
|
loadInBackground: 0
|
||||||
|
ambisonic: 0
|
||||||
|
3D: 1
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Reference in New Issue
Block a user