public void WhenIndependentReachedDestination() { reachedDestination = false; nextDependent = CheckDependentsInSection(); if (nextDependent != null) { agent.SetDestination(nextDependent.GetPos()); pathIndex--; responsibleForIDs.Remove(nextDependent.GetID()); followers.Add(nextDependent); if (nextDependent.GetSpeed() < groupSpeed) { groupSpeed = nextDependent.GetSpeed(); } nextDependent.GetAgent().speed = groupSpeed; nextDependent.SetDestSection(destSection); nextDependent.startedMovement = true; destSection.AddPerson(nextDependent); } else { agent.SetDestination(nodesPath[pathIndex].GetPos()); } UpdateFollowersMovement(); }
public void SetStartingData(int idx_) { if (nodesPath.Count > 0) { pathIndex = idx_; destSection = nodesPath[nodesPath.Count - 1].GetData(); destSection.AddPerson(this); reachedDestination = true; agent.isStopped = true; agent.speed = speed; if (reachedDestination && pathIndex < nodesPath.Count && pathIndex != -1) { WhenIndependentReachedDestination(); } } else { pathIndex = -1; } }