Esempio n. 1
0
    /// <summary>
    /// check all the discs have been destroyed, if they have, fire them out again in a certain pattern
    /// </summary>
    public void Attack()
    {
        if (all_Discs_Are_Destroyed)
        {
            //start attack phase coroutine, then alter the state in Enemy AI
            StartCoroutine(Fire_Discs());
        }

        else
        {
            //do nothing and move onto the next target location and update Enemy Ai
            local_Enemy_Ai.enemy_State = Enemy_AI.State.PICKING_LOCATION_TO_MOVE;
            local_Enemy_Ai.StartCoroutine("Rest");
        }
    }
Esempio n. 2
0
    /// <summary>
    /// If the player is in range and in sight then calls the enemy to start moving towards them
    /// </summary>
    public void Charge_At_Player()
    {
        RaycastHit p_Hit;

        if (Physics.Raycast(transform.position, player_Position.transform.position - transform.position, out p_Hit, Mathf.Infinity, ignore_Layers))
        {
            if (p_Hit.collider.gameObject.layer == 14)
            {
                StopCoroutine("Dash");

                local_Enemy_Ai.StartCoroutine("Pick_Move_Location");
            }
            else if (p_Hit.collider.gameObject.layer == 10)
            {
                StartCoroutine("Dash");
            }
        }
    }
Esempio n. 3
0
 /// <summary>
 /// On collision with the player deal damage
 /// </summary>
 /// <param name="collision"></param>
 private void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         local_Enemy_AI.enemy_State = Enemy_AI.State.RESTING;
         local_Enemy_AI.self_Navmesh_Agent.speed = 0f;
         StopAllCoroutines();
         local_Enemy_AI.StartCoroutine("Rest", local_Enemy_AI.rest_Duration);
     }
 }
Esempio n. 4
0
    /// <summary>
    /// Sends out a raycast to identify the player. If in range and in sight then fires projectiles at their current position
    /// </summary>
    public void Shoot_At_Player()
    {
        RaycastHit p_Hit;

        if (Physics.Raycast(transform.position, local_Enemy_AI.player_Position.transform.position - transform.position, out p_Hit, Mathf.Infinity, ignore_Layers))
        {
            if (p_Hit.collider.gameObject.layer == 14)
            {
                local_Enemy_AI.enemy_State = Enemy_AI.State.PICKING_LOCATION_TO_MOVE;
                local_Enemy_AI.StartCoroutine("Pick_Move_Location");
            }
            else
            {
                shooting = true;
                StartCoroutine("Turn_To_Face_Enemy");

                StartCoroutine("Wait_Between_Bullets");

                local_Enemy_AI.self_Navmesh_Agent.SetDestination(local_Enemy_AI.player_Position.transform.position);
            }
        }
    }
Esempio n. 5
0
    /// <summary>
    /// Sets the radius of the stun collision back to its default state
    /// </summary>
    /// <returns></returns>
    IEnumerator Reset_Radius()
    {
        yield return(new WaitForSeconds(attack_Duration));

        radius_Is_Growing = false;
        local_Particle_System.Stop();
        inner_Collider.radius = inner_Sphere_Radius;
        outer_Collider.radius = outer_Sphere_Radius;
        ParticleSystem new_Rad = local_Particle_System;

        ParticleSystem.ShapeModule shape = new_Rad.shape;
        shape.radius = particle_Sphere_Radius;
        local_Enemy_AI.enemy_State = Enemy_AI.State.RESTING;
        local_Enemy_AI.StartCoroutine("Rest");
    }
    /// <summary>
    /// Searches for any valid enemies to shield in the level and executes the relevant action on them
    /// </summary>
    void Find_Targets()
    {
        GameObject[] curr_Enemies;
        curr_Enemies = Get_Curr_Enemies();
        int loop_Length;

        if (number_Of_Shields < curr_Enemies.Length)
        {
            loop_Length = number_Of_Shields;
        }

        else
        {
            loop_Length = curr_Enemies.Length;
        }
        for (int j = 0; j < loop_Length; j++)
        {
            if (curr_Enemies[j] != gameObject && curr_Enemies[j] != null)
            {
                if (curr_Enemies[j].activeInHierarchy)
                {
                    if (curr_Enemies[j].GetComponent <Enemy_AI>() != null)
                    {
                        switch (local_Support_Type)
                        {
                        case Support_Type.HEALER:

                            curr_Enemies[j].GetComponent <Enemy_AI>().Heal_From_Support();
                            break;

                        case Support_Type.SHIELDER:
                            curr_Enemies[j].GetComponent <Enemy_AI>().Turn_On_Shield_From_Support();
                            break;

                        default:

                            break;
                        }
                    }
                }
            }
        }

        local_Enemy_AI.StartCoroutine("Rest", local_Enemy_AI.rest_Duration);
    }