Example #1
0
    private void Attack(StateController controller)
    {
        RaycastHit hit;

        Debug.DrawRay(controller.eyes.position, controller.eyes.forward.normalized * controller.enemyStats.attackRange, Color.red);

        if (Physics.SphereCast(controller.eyes.position, controller.enemyStats.lookSphereCastRadius, controller.eyes.forward, out hit, controller.enemyStats.attackRange) && hit.collider.CompareTag("Player"))
        {
            if (controller.CheckIfCOuntDownElasped(controller.enemyStats.attackRate))
            {
                controller.tankShooting.Fire(controller.enemyStats.attackForce, controller.enemyStats.attackRate);
            }
        }
    }
Example #2
0
 private bool Scan(StateController controller)
 {
     controller.navMeshAgent.isStopped = true;
     controller.transform.Rotate(0, controller.enemyStats.searchingTurnSpeed * Time.deltaTime, 0);
     return(controller.CheckIfCOuntDownElasped(controller.enemyStats.searchDuration));
 }