} // reset attack void Kick() { if (Input.GetKeyDown(KeyCode.I)) { attackAnim.QuakeKick(); } }
private void Attack() { agent.isStopped = true; agent.velocity = Vector3.zero; anim.Walk(false); attackTimer += Time.deltaTime; if (attackTimer > waitBeforeAttack) { agent.transform.LookAt(targetPos.position); if (Random.Range(0, 4) > 1) { if (Random.Range(0, 3) > 1) { anim.Punch1(); } else { if (Random.Range(0, 3) < 1) { anim.Punch2(); } else { anim.Punch3(); } } } else { anim.QuakeKick(); } attackTimer = 0f; } if (Vector3.Distance(transform.position, targetPos.position) > attackDistance && Vector3.Distance(transform.position, targetPos.position) < shootRadius) { enemyAttack = EnemyAttack.SHOOT; } else if (Vector3.Distance(transform.position, targetPos.position) > shootRadius) { enemyAttack = EnemyAttack.CHASE; } }
} // chase void Attack() { agent.velocity = Vector3.zero; agent.isStopped = true; enemyAnim.Walk(false); attackTimer += Time.deltaTime; if (attackTimer > waitBeforeAttack) { transform.LookAt(PlayerPos.position); if (Random.Range(0, 4) > 1) { if (Random.Range(0, 3) > 1) { enemyAnim.Punch1(); } else { if (Random.Range(0, 3) < 1) { enemyAnim.Punch3(); } else { enemyAnim.QuakeKick(); } } } else { enemyAnim.Punch2(); } attackTimer = 0f; } if (Vector3.Distance(transform.position, PlayerPos.position) > attackDistance + waitBeforeChase) { enemyBehaviour = EnemyAttackBehaviour.CHASE; agent.isStopped = false; } } // attack