Example #1
0
 public void Start()
 {
     if (ParentFollower == null)
     {
         ParentFollower = GetComponentInParent <DeferredFollower>();
     }
 }
Example #2
0
    public void RemoveFront()
    {
        DeferredFollower front = m_allies.RemoveFront();

        OrphanAlly(front);

        UpdateOffsets();
    }
Example #3
0
 public void AddAlly(DeferredFollower ally)
 {
     if (ally != null)
     {
         m_allies.AddBack(ally);
         UpdateOffsets();
     }
 }
Example #4
0
    public void RemoveAlly(DeferredFollower ally)
    {
        if (ally != null)
        {
            m_allies.Remove(ally);
            OrphanAlly(ally);

            UpdateOffsets();
        }
    }
Example #5
0
    public void CycleForward()
    {
        if (m_allies.Count > 0)
        {
            DeferredFollower front = m_allies.RemoveFront();
            OrphanAlly(front);

            m_allies.AddBack(front);
            AdoptAlly(m_allies.Get(0));
        }
    }
Example #6
0
    public void CycleBackward()
    {
        if (m_allies.Count > 0)
        {
            DeferredFollower back  = m_allies.RemoveBack();
            DeferredFollower front = m_allies.Get(0);

            OrphanAlly(front);
            m_allies.AddFront(back);
            AdoptAlly(back);
        }
    }
Example #7
0
 private void OrphanAlly(DeferredFollower ally)
 {
     ally.transform.parent = null;
     ally.RotateToMovement = true;
 }
Example #8
0
 private void AdoptAlly(DeferredFollower ally)
 {
     ally.transform.parent        = gameObject.transform;
     ally.RotateToMovement        = false;
     ally.transform.localRotation = Quaternion.identity;
 }
Example #9
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);
    }