void AttackPlayer() { navAgent.velocity = Vector3.zero; navAgent.isStopped = true; enem_Anim.Walk(false); attack_timer = Time.deltaTime + 1; print(attack_timer + " " + wait_before_attack_time); if (attack_timer > wait_before_attack_time) { //print("YAHAN ata hi nai"); if (Random.Range(0, 2) > 0) { enem_Anim.Attack_0(); } else { enem_Anim.Attack_1(); } attack_timer = 0f; } if (Vector3.Distance(transform.position, playerTarget.transform.position) > attack_distance + chase_after_Attack_distance) { navAgent.isStopped = false; enemy_state = EnemyState.CHASE; } }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.J)) { // playerAnimation.FreezeAnimation(); playerAnimation.Defend(true); shield.ActivateShield(true); } if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); shield.ActivateShield(false); } if (Input.GetKeyDown(KeyCode.L)) { playerAnimation.Attack_0(); } if (Input.GetKeyDown(KeyCode.K)) { playerAnimation.Attack_1(); } }