public void OnTriggerEnter(Collider other)
 {
     Respawn respawn = other.gameObject.GetComponent<Respawn>();
     if (respawn != null)
     {
         respawn.RespawnObject();
     }
 }
示例#2
0
    void RespawnPlayer()
    {
        player.ResetPlayer();
        Respawn playerRespawn = player.GetComponent <Respawn>();

        if (playerRespawn)
        {
            playerRespawn.RespawnObject();
            Debug.Log("Respawning player!");
        }
    }
示例#3
0
    void InitialiseRespawn()
    {
        const int defaultRespawnNode = -1;

        respawn        = GetComponent <Respawn>();;
        waypointNodeID = defaultRespawnNode;
        respawn.AddLastToRespawnAction(() => { Go(0); });
        respawn.AddLastToRespawnAction(() => { Stop(breakForce); });
        respawn.AddLastToRespawnAction(pid.ResetValues);
        respawn.AddLastToRespawnAction(() => { respawn.respawnNode = waypointNodeID - 1; });
        respawn.AddLastToRespawnAction(() => { timeAlive = 0; StartCoroutine(SetIdleOnATimer(2f)); });
        respawn.AddLastToRespawnAction(() => { respawn.RespawnObject(GetNextWayPoint(0), (GetNextWayPoint(0 + 1) - GetNextWayPoint(0)).normalized); });
    }