void defend() { CharacterAnimations component = enemyAnimation.GetComponent <CharacterAnimations>(); playerAnimation.Defend(true); shield.ActivateShield(true); component.Damage(true); StartCoroutine(desactive()); }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.J))//defend when J pressed is down { playerAnimation.Defend(true); playerShield.ActivatedShield(true); } if (Input.GetKeyUp(KeyCode.J))//release defence when J is released { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); playerShield.ActivatedShield(false); } if (Input.GetKeyDown(KeyCode.K)) { attackMovement.Attack(playerAnimation); } }
// Update is called once per frame void Update() { //when you press keys J- defend and K-attack if (Input.GetKeyDown(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(true); } if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.Defend(false); } if (Input.GetKeyDown(KeyCode.K)) { if (Random.Range(0, 2) > 0) { playerAnimation.Attack_1(); } else { playerAnimation.Attack_2(); } } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(2)) { playerAnimation.Defend(true); } if (Input.GetMouseButtonUp(2)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); } if (Input.GetMouseButtonDown(0)) { if (Random.Range(0, 2) > 0) { playerAnimation.Attack_1(); } else { playerAnimation.Attack_2(); } } }