// Use this for initialization
    void Start()
    {
        hCtrl = GetComponent<HealthController> ();

                regenTimer = Time.time;
                maxWill = hCtrl.getMaxHealth ();
                curMaxWill = hCtrl.getCurrentHealth ();
                curWill = maxWill;

                prevHealth = hCtrl.getCurrentHealth ();
    }
Exemplo n.º 2
0
 public override void Start(AI ai)
 {
     base.Start (ai);
             self = ai.WorkingMemory.GetItem<GameObject> ("self");
             aiHealthControl = self.GetComponent<HealthController> ();
             ghostController = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GhostWorldController> ();
             lastHealth = aiHealthControl.getCurrentHealth ();
             gui = self.GetComponent<DebugAP> (); //TODO
             var eCont = self.GetComponent<EquipmentController> ();
             if (eCont != null)
                     selfAtkRng = eCont.GetWeaponRange ();
             //rand = new Random();
 }
Exemplo n.º 3
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;
        }
    }