Pink/Assets/Scripts/Events/PlayerSpawn.cs

27 lines
779 B
C#
Raw Normal View History

using Pink.Environment;
2020-10-01 18:11:43 +01:00
using static Pink.Environment.Simulation;
namespace Pink.Events
{
public class PlayerSpawn : Simulation.Event<PlayerSpawn>
{
EnvironmentModel state = Simulation.GetModel<EnvironmentModel>();
public override void Execute()
{
state.player.controlAllowed = true;
2020-10-01 18:11:43 +01:00
state.player.collider2d.enabled = true;
state.player.health.Reset();
2020-10-01 18:11:43 +01:00
state.player.controller.Teleport(state.spawnPoint.transform.position);
state.player.animator.SetBool("dead", false);
state.virtualCamera.m_Follow = state.player.transform;
state.virtualCamera.m_LookAt = state.player.transform;
2020-10-01 18:11:43 +01:00
// Schedule<EnableControl>(2f);
}
}
}