public void ChangeSoilObject(int soilId, GenerationObject seedObject) { GenerationObject parentSoil = seedObject; SoilMessage m = new SoilMessage(); m.id = soilId; m.soilObject = parentSoil; m.Broadcast(genList[MAX_GENERATIONS - 1].gameObject); for (int i = MAX_GENERATIONS - 2; i >= 0; --i) { m = new SoilMessage(); m.id = soilId; m.soilObject = parentSoil; m.action = Action.INCREMENT_GENERATION; m.numberOfGenerationIncrement = MAX_GENERATIONS - i - 1; m.Broadcast(genList[i].gameObject); } }
public void UnPlantSeed(int soilId) { for (int i = MAX_GENERATIONS - 1; i >= 0; --i) { SoilMessage m = new SoilMessage(); m.id = soilId; m.soilObject = null; m.Broadcast(genList[i].gameObject); } }
public void PushGeneration(Generation gen) { if(genList.Count == 0) { gen.genCamera.IsPlayableCamera = true; gen.IsPlayable = true; } else { SoilScript[] soils = genList[0].GetComponentsInChildren<SoilScript>(); foreach(SoilScript soil in soils) { SoilMessage m = new SoilMessage(); m.id = soil.soilId; m.soilObject = soil.SoilObject; m.action = Action.INCREMENT_GENERATION; m.Broadcast(gen.gameObject); } } if(genList.Count < MAX_GENERATIONS) { gen.genCamera.SkipTransition(); } genList.Insert(0, gen); if(genList.Count > MAX_GENERATIONS) { genList[genList.Count - 1].genCamera.FlaggedForDeath = true; IsTransitioning = true; } while (messages.Count != 0) { messages.Dequeue().Broadcast(gen.gameObject); } dirty = true; }