// Use this for initialization void Start() { hCtrl = GetComponent<HealthController> (); regenTimer = Time.time; maxWill = hCtrl.getMaxHealth (); curMaxWill = hCtrl.getCurrentHealth (); curWill = maxWill; prevHealth = hCtrl.getCurrentHealth (); }
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; } }