Exemple #1
0
    // Update is called once per frame
    void Update()
    {
        //Run this once when activated
        if (behaviourActivated == false)
        {
            rigidbody2D.isKinematic = false;
            behaviourActivated      = true;
        }


        // Verify if health has changed to verify is lizard was attacked.
        if (previousHp != hp.curHealth)
        {
            previousHp  = hp.curHealth;
            wasAttacked = true;
        }
        //verify if enemy is dying
        if (hp.curHealth <= 0)
        {
            isDying = true;
            StopAllCoroutines();
        }
        //Execute current State's update
        _state.Update();
    }