2020-09-30 13:23:01 +01:00
|
|
|
|
using Pink.Environment;
|
2020-10-01 18:11:43 +01:00
|
|
|
|
using UnityEngine;
|
2020-09-30 13:23:01 +01:00
|
|
|
|
|
2020-10-01 18:11:43 +01:00
|
|
|
|
using static Pink.Environment.Simulation;
|
|
|
|
|
|
|
|
|
|
namespace Pink.Events
|
2020-09-30 13:23:01 +01:00
|
|
|
|
{
|
2020-10-01 18:11:43 +01:00
|
|
|
|
class PlayerDeath : Simulation.Event<PlayerDeath>
|
2020-09-30 13:23:01 +01:00
|
|
|
|
{
|
|
|
|
|
EnvironmentModel state = Simulation.GetModel<EnvironmentModel>();
|
|
|
|
|
|
|
|
|
|
public override void Execute()
|
|
|
|
|
{
|
2020-10-01 18:11:43 +01:00
|
|
|
|
if (!state.player.health.IsAlive)
|
2020-09-30 13:23:01 +01:00
|
|
|
|
{
|
2020-10-01 18:11:43 +01:00
|
|
|
|
Debug.Log("Player Died");
|
2020-09-30 13:23:01 +01:00
|
|
|
|
state.player.controlAllowed = false;
|
2020-10-01 18:11:43 +01:00
|
|
|
|
state.player.collider2d.enabled = false;
|
2020-09-30 13:23:01 +01:00
|
|
|
|
|
|
|
|
|
state.virtualCamera.m_Follow = null;
|
|
|
|
|
state.virtualCamera.m_LookAt = null;
|
|
|
|
|
|
2020-10-01 18:11:43 +01:00
|
|
|
|
Schedule<PlayerSpawn>(2);
|
2020-09-30 13:23:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|