/* Takes in a tic tac's path route and instance ID, and updates the correct path. Will move tic tacs forward from queues * depending on where the removed tic tac was previously on the path. */ public void TicTacRemoved(SE.PathRoute removedPathRoute, SE.PathDistance removedPathDistance, int removedInstanceID) { Path removedPath = (removedPathRoute == SE.PathRoute.Melee) ? meleePath : rangedPath; TicTac removedScript = removedPath.scriptDict[removedInstanceID]; if (removedPathDistance == SE.PathDistance.Close && removedPath.scriptDict.Count > pathLimits[0]) { TicTac firstMidScript = removedPath.GetFirstScript(SE.PathDistance.Mid); // Move first mid script up to close distance firstMidScript.CurrPathDistance = SE.PathDistance.Close; firstMidScript.StartAdvanceCoroutine((Random.insideUnitSphere * removedPath.radii[0]) + removedPath.centers[0], 0.0f); if (removedPath.scriptDict.Count > pathLimits[1]) { TicTac firstFarScript = removedPath.GetFirstScript(SE.PathDistance.Far); // Move first far script up to mid distance firstFarScript.CurrPathDistance = SE.PathDistance.Mid; firstFarScript.StartAdvanceCoroutine((Random.insideUnitSphere * removedPath.radii[1]) + removedPath.centers[1], 0.0f); } } else if (removedPathDistance == SE.PathDistance.Mid && removedPath.scriptDict.Count > pathLimits[1]) // Removed tic tac was far { TicTac firstFarScript = removedPath.GetFirstScript(SE.PathDistance.Far); // Move first far script up to mid distance firstFarScript.CurrPathDistance = SE.PathDistance.Mid; firstFarScript.StartAdvanceCoroutine((Random.insideUnitSphere * removedPath.radii[1]) + removedPath.centers[1], 0.0f); } removedPath.scriptDict.Remove(removedInstanceID); }
public Dictionary <int, TicTac> scriptDict = new Dictionary <int, TicTac>(); // A dictionary whose values consist of the scripts of // the tic tacs on this path, with keys of the tic tacs' // instance IDs public TicTac GetFirstScript(SE.PathDistance pathDistance) { foreach (TicTac ticTacScript in scriptDict.Values) { if (ticTacScript.CurrPathDistance == pathDistance) { return(ticTacScript); } } return(null); }