fix: edit a level (#66)

Co-authored-by: Djelal BOUDJI <djelal@gmail.com>
Co-authored-by: Théo LUDWIG <contact@theoludwig.fr>
This commit is contained in:
M VINCENT PETT
2025-05-16 20:03:37 +02:00
committed by GitHub
parent 0b32ce7036
commit 728c57c66c
7 changed files with 209 additions and 66 deletions

View File

@@ -91,22 +91,25 @@ public class Player : MonoBehaviour
{
CurrentGameMode?.OnCollisionEnter(this, collision);
if (editMode && (collision.gameObject.CompareTag("Kill") || collision.gameObject.CompareTag("Win")))
{
GameObject spawn = new GameObject("AutoSpawnPoint");
spawn.transform.position = new Vector3(-16, -3, 0f);
transform.position = spawn.transform.position;
RigidBody.linearVelocity = Vector2.zero;
SpeedMultiplier = 1f;
CurrentGameMode = new NormalGameMode();
SpriteRenderer.sprite = Resources.Load<Sprite>("Shapes/BaseSquare");
return;
}
if (collision.gameObject.CompareTag("Kill"))
{
if (editMode)
{
GameObject spawn = new GameObject("AutoSpawnPoint");
spawn.transform.position = new Vector3(-16, -3, 0f);
transform.position = spawn.transform.position;
RigidBody.linearVelocity = Vector2.zero;
SpeedMultiplier = 1f;
}
else
{
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "death"));
sfxSource.Play();
StartCoroutine(LevelHomeButton.PlaySoundAndLoadScene(sfxSource, SceneManager.GetActiveScene().name));
}
sfxSource.clip = Resources.Load<AudioClip>(Path.Combine("Sounds", "death"));
sfxSource.Play();
StartCoroutine(LevelHomeButton.PlaySoundAndLoadScene(sfxSource, SceneManager.GetActiveScene().name));
}
if (collision.gameObject.CompareTag("Win"))