void AttackPlayer() { navAgent.velocity = Vector3.zero; navAgent.isStopped = true; enemy_Anim.Walk(false); attack_Timer += Time.deltaTime; if (attack_Timer > wait_Before_Attack_Time) { if (Random.Range(0, 2) > 0) { enemy_Anim.Attack_1(); } else { enemy_Anim.Attack_2(); } attack_Timer = 0f; } if (Vector3.Distance(transform.position, playerTarget.position) > attack_Distance + chase_After_Attack_Distance) { navAgent.isStopped = false; enemy_State = EnemyState.CHASE; } }
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; } }
} // awake void Update() { if (Input.GetKeyDown(KeyCode.J)) // defend { playerAnimation.Defend(true); shield.ActivateShield(true); } if (Input.GetKeyUp(KeyCode.J)) // defend { playerAnimation.UnfreezeAnimation(); playerAnimation.Defend(false); shield.ActivateShield(false); } if (Input.GetKeyDown(KeyCode.K)) // attack { if (Random.Range(0, 2) > 0) // Range(inclusive, exclusive) but with float the second param is included { playerAnimation.Attack_1(); soundFx.Attack1(); } else { playerAnimation.Attack_2(); soundFx.Attack2(); } } } // update
void Update() { //Defend input (key J) if (Input.GetKeyDown(KeyCode.J)) { playerAnimation.Defend(true); shield.ActivateShield(true); } //Stop blocking with shield if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); shield.ActivateShield(false); } if (Input.GetKeyDown(KeyCode.K)) { if (Random.Range(0, 2) > 0) { playerAnimation.Attack_1(); soundFX.Attack_1(); } else { playerAnimation.Attack_2(); soundFX.Attack_2(); } } }
void Update() { if (Input.GetKeyDown(KeyCode.J)) { playerAnimation.Defend(true); shield.ActivateShield(true); } if (Input.GetKeyUp(KeyCode.J)) { playerAnimation.UnFreezeAnimation(); playerAnimation.Defend(false); shield.ActivateShield(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.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(); } }
void AttackLight() { if (healthScript.shieldActivated == false) { soundFX.Attack(); playerAnimation.Attack_1(); a = true; } }
public void Attack(CharacterAnimations animations) { if (Random.Range(0, 2) > 0) { animations.Attack_1(); soundFX.Attack_1(); } else { animations.Attack_2(); soundFX.Attack_2(); } }
// 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(); } } }