コード例 #1
0
 IEnumerator revive()
 {
     while (!deadTimerDone)
     {
         //wait for showFloatingText
         yield return(new WaitForSeconds(0.1f));
     }
     healthbarScript.GainHealth(100);
     photonView.RPC("UpdateHealth", RpcTarget.All, healthbarScript.health);
     deadTimerDone = false;
     dead          = false;
     PlayerPrefs.SetInt("dead", 0);
     healthbarScript.ChangeHealthbarColor(new Color(0.35f, 1f, 0.35f));
     ballAmountScript.setBallAmount(5);
 }
コード例 #2
0
 public void PrepareForGameStart()
 {
     healthbar.GainHealth(healthbar.maximumHealth);
     SetTextCenter("");
     MoveScoreBoard(428);
     healthbar.gameObject.SetActive(true);
 }
コード例 #3
0
 void OnCollisionEnter(Collision collisionInfo)
 {
     if (collisionInfo.collider.tag == "Key")
     {
         FindObjectOfType <AudioManager>().Play("KeyCollect");
         keyCollected = true;
         Destroy(collisionInfo.gameObject);
         Color temp = keyimg.color; //we need to assign to a variable and do it
         temp.a       = 1f;
         keyimg.color = temp;
         if (canReduceHealth)
         {
             hb.GainHealth(50);
             canReduceHealth = false;
         }
     }
     if (collisionInfo.collider.tag == "Door")
     {
         if (keyCollected)
         {
             FindObjectOfType <AudioManager>().Play("DoorOpened");
             Destroy(collisionInfo.gameObject);
             Color temp = keyimg.color;
             temp.a       = 0.4f;
             keyimg.color = temp;
         }
     }
     if (collisionInfo.collider.tag == "Invisibility Orb")
     {
         FindObjectOfType <AudioManager>().Play("OrbCollect");
         StartCoroutine("HideUnhideWalls");
         Destroy(collisionInfo.gameObject);
     }
     if (collisionInfo.collider.tag == "Immunity Orb")
     {
         FindObjectOfType <AudioManager>().Play("OrbCollect");
         StartCoroutine("ActivateDeactivateImmunity");
         Destroy(collisionInfo.gameObject);
     }
     if (collisionInfo.collider.tag == "Ghost")
     {
         if (immunityOrbCollected)
         {
             Destroy(collisionInfo.gameObject);
             FindObjectOfType <AudioManager>().Play("Pop");
         }
         else
         {
             FindObjectOfType <AudioManager>().Play("OOF");
             hb.TakeDamage(20);
         }
     }
     if (collisionInfo.collider.tag == "Lava Ball")
     {
         if (immunityOrbCollected)
         {
             Destroy(collisionInfo.gameObject);
             FindObjectOfType <AudioManager>().Play("Pop");
         }
         else
         {
             FindObjectOfType <AudioManager>().Play("OOF");
             hb.TakeDamage(50);
         }
     }
     if (collisionInfo.collider.tag == "Start Platform")
     {
         Debug.Log("Starting");
     }
     if (collisionInfo.collider.tag == "End Platform")
     {
         FindObjectOfType <AudioManager>().Play("LevelComplete");
         Debug.Log("Finished Level! Congrats!");
         Time.timeScale = 0f;
         checkAndStoreScore(ml.timeElapsed);
         EndCardUI.SetActive(true);
     }
 }
コード例 #4
0
    public void NewRelScore(int damage)
    {
        healthBar.GainHealth(damage);

        relDescText.text = PlayerSatisfaction(healthBar.health);
    }