Example #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Waypoint" && path != AIMovement.Paths.air)
     {
         ai.NextPoint(agent, this, false);
     }
 }
Example #2
0
    protected override void Start()
    {
        ai = FindObjectOfType <AIMovement>();
        if (path != AIMovement.Paths.air)
        {
            int temp = Find();
            if (temp == 0)
            {
                path             = AIMovement.Paths.path1;
                gameObject.layer = 13;
            }
            else if (temp == 1)
            {
                path             = AIMovement.Paths.path2;
                gameObject.layer = 14;
            }
            else if (temp == 2)
            {
                path             = AIMovement.Paths.path3;
                gameObject.layer = 15;
            }
            else if (temp == 3)
            {
                path             = AIMovement.Paths.path4;
                gameObject.layer = 16;
            }
        }

        base.Start();
        agent = GetComponent <NavMeshAgent> ();
        currentDestination = 0;
        ai.NextPoint(agent, this, true);
        canShoot = true;

        if (enemyType == AttackType.air)
        {
            if (fireRate == 0)
            {
                fireRate = 1;
            }
            cooldown = 1 / fireRate;
            time     = cooldown;
        }
    }