Exemple #1
0
    public void resetCoverforselected(Vector3 hit, unitWay other, bool requiresPath = true, bool includeChildren = false, bool resetFollow = false)
    {
        //reset data for selected
        if (resetFollow)
        {
            other.resetFollow();
            other.foundEnemyLastSeen.Clear();
        }

        if (requiresPath)
        {
            pathData tempPath = new pathData(hit, 2);
            other.setPath(tempPath, 0, 0);
        }

        cover [other.index].free = true;
        other.coverPos           = Vector3.zero;

        other.follow = true;

        //repeat for all children of selected
        if (includeChildren)
        {
            foreach (unitWay obj in other.returnAllFollowers())
            {
                obj.coverPos           = Vector3.zero;
                cover [obj.index].free = true;
            }
        }
    }
Exemple #2
0
    public void findCoverForSelected(Vector3 hit, Collider otherCol, unitWay other, bool requiresPath = true, bool includeChildren = false, bool resetFollow = false, List <int> ignoreIndex = null)
    {
        List <unitWay> temp = new List <unitWay>();

        temp.Add(other);
        findCoverForSelected(hit, otherCol, temp, requiresPath, includeChildren, resetFollow, ignoreIndex);
    }
Exemple #3
0
    public int gatherFollowing()
    {
        unitWay temp  = this;
        int     value = 0;

        while (temp.target.GetComponent <unitWay>())
        {
            value += 1;
            temp   = temp.target.GetComponent <unitWay> ();
        }
        return(value);
    }
Exemple #4
0
 //loop through followers and remove _follower if found
 public void removeFollower(unitWay _follower)
 {
     for (int a = 0; a < follower.Count; a++)
     {
         if (follower [a] == _follower)
         {
             follower.RemoveAt(a);
             return;
         }
     }
     gatherFollowers();
 }
Exemple #5
0
 public void requestCover(unitWay requester, bool requiresPath = true, bool includeChildren = false, bool resetFollow = false, List <int> ignoreIndex = null)
 {
     findCoverForSelected(requester.transform.position, requester.GetComponent <Collider>(), requester, requiresPath, includeChildren, resetFollow, ignoreIndex);
 }