Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

인게임 particle 적용 #138

Merged
merged 4 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions Assets/Scenes/LevelOneScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -16555,6 +16555,53 @@ Transform:
m_CorrespondingSourceObject: {fileID: 253986412282149583, guid: ca1aa9b18dfd040b4a78ed24cb2df9bf, type: 3}
m_PrefabInstance: {fileID: 666104837}
m_PrefabAsset: {fileID: 0}
--- !u!1 &666761484
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 666761486}
- component: {fileID: 666761485}
m_Layer: 0
m_Name: ParticleManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &666761485
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 666761484}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d8c95c6be162b4134b6a802f6274b722, type: 3}
m_Name:
m_EditorClassIdentifier:
respawnEffect: {fileID: 2641121113345803941, guid: bac9dfb673bd44a83b396dc74e134bbf, type: 3}
disposeEffect: {fileID: 2641121113345803941, guid: 2bf7e45ce383a43e6bfa101d3113d1a7, type: 3}
clearEffect: {fileID: 2641121113345803941, guid: 2bf7e45ce383a43e6bfa101d3113d1a7, type: 3}
--- !u!4 &666761486
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 666761484}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 23.554657, y: -436.81015, z: 596.1596}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 12
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &666771378
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -44288,6 +44335,7 @@ MonoBehaviour:
moveSpeed: 2
rotationSpeed: 10
referenceSpeed: 0.5
particleManager: {fileID: 666761485}
--- !u!114 &1793613793
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
48 changes: 48 additions & 0 deletions Assets/Scenes/LevelTwoScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -5624,6 +5624,53 @@ MonoBehaviour:
zStart: 0.5
zStep: 1
y: 0.49
--- !u!1 &84927914
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 84927916}
- component: {fileID: 84927915}
m_Layer: 0
m_Name: ParticleManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &84927915
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 84927914}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: d8c95c6be162b4134b6a802f6274b722, type: 3}
m_Name:
m_EditorClassIdentifier:
respawnEffect: {fileID: 2641121113345803941, guid: bac9dfb673bd44a83b396dc74e134bbf, type: 3}
disposeEffect: {fileID: 2641121113345803941, guid: 2bf7e45ce383a43e6bfa101d3113d1a7, type: 3}
clearEffect: {fileID: 2641121113345803941, guid: 2bf7e45ce383a43e6bfa101d3113d1a7, type: 3}
--- !u!4 &84927916
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 84927914}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 23.554657, y: -436.81015, z: 596.1596}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 14
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &85619834
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -33274,6 +33321,7 @@ MonoBehaviour:
moveSpeed: 2
rotationSpeed: 10
referenceSpeed: 0.5
particleManager: {fileID: 84927915}
--- !u!114 &508233734
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/LevelClear.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,6 @@ public void Restart()
}

AudioManager.Instance.PlaySFX("ButtonClick");
SceneManager.LoadScene("Level" + level.ToString());

}
}
36 changes: 36 additions & 0 deletions Assets/Scripts/ParticleManager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ParticleManager : MonoBehaviour
{
public ParticleSystem respawnEffect;
public ParticleSystem disposeEffect;
public ParticleSystem clearEffect;

public void PlayRespawnEffect(Vector3 position)
{
if (respawnEffect != null)
{
Instantiate(respawnEffect, position, Quaternion.identity).Play();
}
}

public void PlayDisposeEffect(Vector3 position)
{
if (disposeEffect != null)
{
Instantiate(disposeEffect, position, Quaternion.identity).Play();
}
}

public IEnumerator PlayLevelClearEffect(Vector3 position)
{
if (clearEffect != null)
{
Instantiate(clearEffect, position, Quaternion.identity).Play();
}
yield return new WaitForSeconds(1.5f);
}

}
11 changes: 11 additions & 0 deletions Assets/Scripts/ParticleManager.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 11 additions & 4 deletions Assets/Scripts/PlayerBehaviour.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class PlayerBehaviour : MonoBehaviour

private float goalZ;

[SerializeField] private ParticleManager particleManager;

private void Start()
{
_obstacleTilemap = obstacleGrid.GetComponentInChildren<Tilemap>();
Expand Down Expand Up @@ -85,12 +87,13 @@ private void Update()

if (transform.position.z >= goalZ)
{
ClearGame();
StartCoroutine(ClearGame());
}
}

private void ClearGame()
private IEnumerator ClearGame()
{
yield return StartCoroutine(particleManager.PlayLevelClearEffect(transform.position));
int level = DataManager.Instance.GetActiveLevelData().level;
int score = ScoreModel.Instance.CalculateFinalScore(transform.position.z);
ActiveLevelData levelClearData = new ActiveLevelData(level, score);
Expand Down Expand Up @@ -212,7 +215,7 @@ public void Respawn()
// If respawn position is past goal, clear game
if (transform.position.z >= goalZ)
{
ClearGame();
StartCoroutine(ClearGame());
return;
}

Expand All @@ -230,7 +233,10 @@ public void Respawn()

// Stop walking animation
_isWalking = false;
_animator.SetBool("isWalking", false);
_animator.SetBool("isWalking", false);

// Play Respawn Particle
particleManager.PlayRespawnEffect(transform.position);
}

private void QuantizePosition()
Expand Down Expand Up @@ -283,6 +289,7 @@ public void DisposeTrash()
StageManager.Instance.bagController.RemoveTrash();
trashType = StageManager.Instance.bagController.GetFirstTrashType();
}
particleManager.PlayDisposeEffect(transform.position);

StartCoroutine(nameof(TrashDisposeCooldownRoutine));
}
Expand Down
Loading