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; } } }
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); }
public int gatherFollowing() { unitWay temp = this; int value = 0; while (temp.target.GetComponent <unitWay>()) { value += 1; temp = temp.target.GetComponent <unitWay> (); } return(value); }
//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(); }
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); }