コード例 #1
0
    // A function to respawn the player at a random respawn staion.
    public void RandomSpawn_FromDeath()
    {
        // Setting player to death incase they get here and they're not.
        if (isAlive)
        {
            isAlive = false;
        }

        // Turning off the players controls:
        isControllable = false;

        // Remembers the Mech Station/ Respawn point that the player will spawn at
        if (station == null)
        {
            station = RespawnArray.instance.GetRandomSpawnPoint().GetComponent <Mech_Recovery>();
        }

        // Enabling the respawn timer UI:
        respawnTimerUI.SetActive(true);

        // Starting the respawn timer:
        if (ReadyToRespawn())
        {
            // Disabling the respawn timer UI:
            respawnTimerUI.SetActive(false);

            // Spawning in the player:
            station.SpawnPlayer(this);

            // Enabling the players controls:
            if (!isTestDummy)
            {
                isControllable = true;
            }

            // Turning on invulnerablity:
            isInvulnerable = true;
        }
    }
コード例 #2
0
 public void RandomSpawn_Unactive()
 {
     // Spawning in the player.
     station = RespawnArray.instance.GetRandomSpawnPoint().GetComponent <Mech_Recovery>();
     station.SpawnPlayer(this);
 }