Exemplo n.º 1
0
 void OnTriggerStay(Collider other)
 {
     if (other.tag == "Player" && ghostCtrl.deathTransition <= 0) {
                     if (tag != "ActiveCheckpoint") {
                             if (GameObject.FindGameObjectWithTag ("ActiveCheckpoint") != null) {
                                     GameObject.FindGameObjectWithTag ("ActiveCheckpoint").tag = "Untagged";
                             }
                             tag = "ActiveCheckpoint";
                             activateSource.Play ();
                     }
                     hCont = other.GetComponent<HealthController> ();
                     hCont.adjustCurrentHealth (Time.deltaTime * healSpeed);
             }
 }
Exemplo n.º 2
0
    void Update()
    {
        if (!game.isInGhostMode)
        {
            Destroy(gameObject);
        }

        if (spawn && game.isInGhostMode)
        {
            hCtrl = GameObject.FindWithTag("Player").GetComponent<HealthController>();
            if (game.timeLeftToReviveFromGhostMode <= game.timeToReviveInGhostMode)
            {
                GameObject.FindWithTag("Player").GetComponent<MovementController>().SetCanMove(false);
                game.timeLeftToReviveFromGhostMode += reviveSpeed * Time.deltaTime;
            } else
            {
                hCtrl.adjustCurrentHealth(hCtrl.getMaxHealth() - hCtrl.getCurrentHealth());
                GameObject.FindWithTag("Player").GetComponent<MovementController>().SetCanMove(true);
            }
        } else if (game.isInGhostMode)
        {
            spawn = false;
        }
    }