Example #1
0
    /// <summary>
    /// Checks the Inputs for a Skill
    /// </summary>
    public void Update()
    {
        if (m_skills.Count > 0)
        {
            if (Input.GetButtonDown(CYCLE_FWD_BTN))
            {
                m_skills.AddBack(m_skills.RemoveFront());

                if (m_orbiter != null)
                {
                    m_orbiter.CycleForward();
                }
            }
            else if (Input.GetButtonDown(CYCLE_BCK_BTN))
            {
                m_skills.AddFront(m_skills.RemoveBack());

                if (m_orbiter != null)
                {
                    m_orbiter.CycleBackward();
                }
            }

            if (Input.GetButtonDown(DROP_BTN))
            {
                if (m_skills.Get(0).Ally != DefaultAlly)
                {
                    DeferredFollower allyFollower = m_orbiter.ActiveAlly;
                    Ally             pickup       = allyFollower.gameObject.GetComponentInChildren <Ally>();

                    // Enables the pickup collider
                    pickup.Drop();

                    // Find the closest available point between the Player and the Crosshair to place the
                    // dropped Ally
                    NavMeshHit hit;
                    allyFollower.ForcePathfinding();
                    if (NavMesh.SamplePosition(m_aim.Target, out hit, MAX_DROP_RADIUS, NavMesh.AllAreas))
                    {
                        allyFollower.Target = hit.position;
                    }
                    else
                    {
                        allyFollower.Target = m_aim.Target;
                    }

                    // Remove ally
                    m_orbiter.RemoveFront();

                    // Remove ally's skillset
                    m_skills.RemoveFront();
                }
            }

            if (Input.GetButtonDown(PICKUP_BTN) && m_collidedAllies.Count > 0)
            {
                m_collidedAllies.Sort(DistanceSort);
                AddAlly(m_collidedAllies[0]);
            }
        }
        RunSkill(PRIMARY_FIRE_BTN, m_skills.Get(0).AttackSkill);
        RunSkill(DASH_BTN, m_skills.Get(0).DashSkill);
    }