Import 2D Level

This commit is contained in:
2026-04-30 00:53:30 +02:00
parent c67979c7cf
commit 5797038baf
479 changed files with 430785 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
using Platformer.Core;
using Platformer.Mechanics;
using Platformer.Model;
namespace Platformer.Gameplay
{
/// <summary>
/// Fired when the player is spawned after dying.
/// </summary>
public class PlayerSpawn : Simulation.Event<PlayerSpawn>
{
PlatformerModel model = Simulation.GetModel<PlatformerModel>();
public override void Execute()
{
var player = model.player;
player.collider2d.enabled = true;
player.controlEnabled = false;
if (player.audioSource && player.respawnAudio)
player.audioSource.PlayOneShot(player.respawnAudio);
player.health.Increment();
player.Teleport(model.spawnPoint.transform.position);
player.jumpState = PlayerController.JumpState.Grounded;
player.animator.SetBool("dead", false);
model.virtualCamera.Follow = player.transform;
model.virtualCamera.LookAt = player.transform;
Simulation.Schedule<EnablePlayerInput>(2f);
}
}
}