Example #1
0
 // Use this for initialization
 void Awake()
 {
     anim = GetComponent <Animator>();
     time = 0f;
     playerController.menu_actived(true);
     selectedItem = 1; // new game
     anim.SetBool("HoverMainNewGame", true);
 }
    public void takeDamage(float damage)
    {
        if (actual_health != 0)
        {
            if (animator.GetBool("guarding") && !capacity_Controller.list_of_capacity.Contains(Capacity.DARK_WATER_SHIELD))
            {
                damage -= guarding_resistance;
            }
            else if (animator.GetBool("guarding") && capacity_Controller.list_of_capacity.Contains(Capacity.DARK_WATER_SHIELD))
            {
                damage -= guarding_shield;
            }

            if (capacity_Controller.list_of_capacity.Contains(Capacity.LIGHT_EARTH_ARMOR))
            {
                damage -= guarding_shield;
            }

            if (damage < 0)
            {
                damage = 0;
            }

            if (actual_health - damage <= 0)
            {
                actual_health = 0;
                animator.SetTrigger("death");
                UI_anim.SetTrigger("lose");
                player_Controller.menu_actived(true);
            }
            else
            {
                animator.SetTrigger("hit");
                actual_health -= damage;
            }
            ui.setLife(actual_health);
        }
    }
 public void Pause()
 {
     anim.SetBool("Paused", true);
     playerController.menu_actived(true);
     paused = true;
 }