2020-09-30 13:23:01 +01:00
|
|
|
|
using Pink.Environment;
|
2020-10-03 09:40:51 +01:00
|
|
|
|
using Pink.Items;
|
2020-10-01 18:11:43 +01:00
|
|
|
|
using static Pink.Environment.Simulation;
|
|
|
|
|
|
2020-10-03 09:40:51 +01:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
2020-10-01 18:11:43 +01:00
|
|
|
|
namespace Pink.Events
|
2020-09-30 13:23:01 +01:00
|
|
|
|
{
|
|
|
|
|
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;
|
2020-09-30 13:23:01 +01:00
|
|
|
|
|
|
|
|
|
state.player.health.Reset();
|
2020-10-01 18:11:43 +01:00
|
|
|
|
state.player.controller.Teleport(state.spawnPoint.transform.position);
|
2020-09-30 13:23:01 +01:00
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-10-03 09:40:51 +01:00
|
|
|
|
state.hud.Reset();
|
|
|
|
|
state.items.ResetItems();
|
|
|
|
|
|
2020-10-01 18:11:43 +01:00
|
|
|
|
// Schedule<EnableControl>(2f);
|
2020-09-30 13:23:01 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|