コード例 #1
0
    public void RespawnPlayer()
    {
        isRespawning = true;

        playerData = SaveSystem.LoadPlayer();

        player.transform.position = new Vector3(playerData.playerPosition[0], playerData.playerPosition[1], playerData.playerPosition[2]);
        player.SetActive(true);

        playerStats.UpdateHealth(playerData.playerHealth);

        playerStats.GetKey("Yellow Key", playerData.yellowKey);
        playerStats.GetKey("Blue Key", playerData.blueKey);
        playerStats.GetKey("Red Key", playerData.redKey);

        if (!playerData.yellowKey && !YellowKey.activeSelf)
        {
            YellowKey.SetActive(true);
            YellowKey.GetComponent <Animator> ().SetBool("Taken", false);
        }

        if (!playerData.blueKey && !BlueKey.activeSelf)
        {
            BlueKey.SetActive(true);
            BlueKey.GetComponent <Animator> ().SetBool("Taken", false);
        }

        if (!playerData.redKey && !RedKey.activeSelf)
        {
            RedKey.SetActive(true);
            RedKey.GetComponent <Animator> ().SetBool("Taken", false);
        }
    }
コード例 #2
0
ファイル: Keys.cs プロジェクト: CerjioNava/Shooter-2D-Scripts
 public void DisableKey(string keyColor)
 {
     if (keyColor == "Yellow Key")
     {
         YellowKey.SetActive(false);
     }
     else if (keyColor == "Blue Key")
     {
         BlueKey.SetActive(false);
     }
     else if (keyColor == "Red Key")
     {
         RedKey.SetActive(false);
     }
 }
コード例 #3
0
ファイル: Keys.cs プロジェクト: CerjioNava/Shooter-2D-Scripts
 void Awake()
 {
     YellowKey.SetActive(false);
     BlueKey.SetActive(false);
     RedKey.SetActive(false);
 }