private void Button_ClickSave(object sender, RoutedEventArgs e) { //WIP string CartBox = ArtBox.SelectedItems.ToString(); string Comboselectedmonth = DateBoxMonth.SelectedItem.ToString(); string Comboselectedyear = DateBoxYear.SelectedItem.ToString(); string Agynentxt = GyneBox.Text.ToString(); string Aworkertxt = WorkerBox.Text.ToString(); string Asoldiertxt = SoldierBox.Text.ToString(); Colony ColonyOne = new Colony(); ColonyOne.Cname = NameBox.Text; ColonyOne.Cart = CartBox; ColonyOne.Cnote = NoteBox.Text; ColonyOne.Cgdatummonth = Comboselectedmonth; ColonyOne.Cgdatumyear = Comboselectedyear; ColonyOne.Agynen = Agynentxt; ColonyOne.Aworker = Aworkertxt; ColonyOne.Asoldiers = Asoldiertxt; //nn to check if folder exists, "System.IO.Directory.CreateDirectory" does that for us string mydocs = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); System.IO.Directory.CreateDirectory(mydocs + "/AntManager"); System.Xml.Serialization.XmlSerializer writer = new System.Xml.Serialization.XmlSerializer(typeof(Colony)); var path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/AntManager/AntManagerSaveFile.xml"; System.IO.FileStream file = System.IO.File.Create(path); writer.Serialize(file, ColonyOne); file.Close(); }
public void colonySelected(Colony selectedColony) { if (selectedObject) objectDeselected(); if (this.selectedColony) this.selectedColony.deselect(); this.selectedColony = selectedColony; selectedColony.select(); colonyInformationPanel.transform.Find("Title").gameObject.GetComponent<Text>().text = "COLONY: " + selectedColony.getTermites() + " TERMITES"; if (selectedColony.getTermites() == 1) colonyInformationPanel.transform.Find("Slider/Max").GetComponent<Text>().text = "1"; else colonyInformationPanel.transform.Find("Slider/Max").GetComponent<Text>().text = (selectedColony.getTermites() - 1) + ""; for (int i = 0; i < 5; i++) colonyActiveBoostersIcons[i].SetActive(false); /* foreach (Booster booster in selectedColony.boosters) colonyActiveBoostersIcons[(int)booster.getModel() - 1].SetActive(true);*/ colonyInformationPanel.SetActive(true); noInformationPanel.SetActive(false); }
public void OnDrag(PointerEventData eventData) { if (isDraggable) if (contains) { cursor.transform.position = Input.mousePosition; RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, Costants.RAYCAST_MASK); if (hit.collider != null) { GenericObject obj = hit.collider.gameObject.transform.parent.GetComponent<EatableObject>(); if ((obj) && (obj.getAttacker())) { if (previousSelectedObject) previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = obj; previousSelectedColony = obj.getAttacker(); obj.select(ObjectSelection.Model.ColonyTarget); } else if (previousSelectedObject) { previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = null; previousSelectedColony = null; } } else if (previousSelectedObject) { previousSelectedObject.deselect(ObjectSelection.Model.BoosterApplication); previousSelectedObject = null; previousSelectedColony = null; } } }
public static bool OwnerIsOnline(this Colony source) { return(source.Owners.Any(o => o.IsConnected())); }
public string GetDescription(Colony colony, Players.Player player) { return(LocalizationHelper.LocalizeOrDefault("NotEnoughJobs", player)); }
public IPandaZombie GetNewInstance(Path path, Colony p) { return(new JackbNimble(path, p)); }
public override IAreaJob CreateAreaJob( Colony owner, Vector3Int min, Vector3Int max, bool isLoaded, int npcID = 0) => (IAreaJob) new BlockFarmAreaJobDefinition.BlockFarmAreaJob(this, owner, min, max, npcID);
protected virtual void Awake() { attacker = null; obj = transform.Find("Object").gameObject; obj.GetComponent<EatableObjectSelector>().setObj(this); }
public void SetMyColony(GameObject myColony) { this.myColony = myColony; myColonyComp = myColony.gameObject.GetComponent<Colony> (); commModule.SetColonyComponent (myColonyComp); }
public void ApplyLevel(Colony colony, int unlockedLevels, bool isLoading) { }
public void OnEndDrag(PointerEventData eventData) { if (isDraggable) { if (previousSelectedObject) if (previousSelectedColony) { if (previousSelectedColony.applyBooster(model)) { GameManager.getLevelGUI().usedBooster(model); for (int i = 0; i < GameManager.getCurrentLevel().getCollectedBoosters().Count; i++) { Booster b = GameManager.getCurrentLevel().getCollectedBoosters()[i]; if (b.getModel().Equals(model)) { GameManager.getCurrentLevel().getCollectedBoosters().RemoveAt(i); break; } } } previousSelectedObject.deselect(ObjectSelection.Model.ColonyTarget); previousSelectedObject = null; previousSelectedColony = null; } cursor.transform.position = startPosition; } }
public void setOwner(Colony owner) { this.owner = owner; }
private void setTarget(Colony col) { this.target = col; }
public static bool EvaluateSettlers(Players.Player p) { var update = false; if (p.IsConnected) { var colony = Colony.Get(p); var state = PlayerState.GetPlayerState(p); if (state.NextGenTime == 0) { state.NextGenTime = Time.SecondsSinceStartDouble + Random.Next(8, 16 - Pipliz.Math.RoundToInt(p.GetTempValues(true) .GetOrDefault(PandaResearch.GetResearchKey(PandaResearch.TimeBetween), 0f))) * TimeCycle .SecondsPerHour; } if (Time.SecondsSinceStartDouble > state.NextGenTime && colony.FollowerCount >= MAX_BUYABLE) { var chance = p.GetTempValues(true) .GetOrDefault(PandaResearch.GetResearchKey(PandaResearch.SettlerChance), 0f) + state.Difficulty.AdditionalChance; chance += SettlerEvaluation.SpawnChance(p, colony, state); var rand = Random.NextFloat(); if (chance > rand) { var addCount = Math.Floor(state.MaxPerSpawn * chance); // if we lost alot of colonists add extra to help build back up. if (colony.FollowerCount < state.HighestColonistCount) { var diff = state.HighestColonistCount - colony.FollowerCount; addCount += Math.Floor(diff * .25); } try { var skillChance = p.GetTempValues(true) .GetOrDefault(PandaResearch.GetResearchKey(PandaResearch.SkilledLaborer), 0f); var numbSkilled = 0; rand = Random.NextFloat(); try { if (skillChance > rand) { numbSkilled = state.Rand.Next(1, 2 + Pipliz.Math.RoundToInt(p.GetTempValues(true) .GetOrDefault(PandaResearch.GetResearchKey(PandaResearch.NumberSkilledLaborer), 0f))); } } catch (Exception ex) { PandaLogger.Log("NumberSkilledLaborer"); PandaLogger.LogError(ex); } if (addCount > 0) { if (addCount > 30) { addCount = 30; } var reason = string.Format(SettlerReasoning.GetSettleReason(), addCount); if (numbSkilled > 0) { if (numbSkilled == 1) { reason += string.Format(" {0} of them is skilled!", numbSkilled); } else { reason += string.Format(" {0} of them are skilled!", numbSkilled); } } PandaChat.Send(p, reason, ChatColor.magenta); var playerPos = new Vector3Int(p.Position); for (var i = 0; i < addCount; i++) { var newGuy = new NPCBase(NPCType.GetByKeyNameOrDefault("pipliz.laborer"), BannerTracker.GetClosest(p, playerPos).KeyLocation.Vector, colony); SettlerInventory.GetSettlerInventory(newGuy); newGuy.GetTempValues().Set(ISSETTLER, true); if (i <= numbSkilled) { var npcTemp = newGuy.GetTempValues(true); npcTemp.Set(GameLoader.ALL_SKILLS, state.Rand.Next(1, 10) * 0.002f); } update = true; ModLoader.TriggerCallbacks(ModLoader.EModCallbackType.OnNPCRecruited, newGuy); } } } catch (Exception ex) { PandaLogger.Log("SkilledLaborer"); PandaLogger.LogError(ex); } if (colony.FollowerCount > state.HighestColonistCount) { state.HighestColonistCount = colony.FollowerCount; } } state.NextGenTime = Time.SecondsSinceStartDouble + Random.Next(8, 16 - Pipliz.Math.RoundToInt(p.GetTempValues(true) .GetOrDefault(PandaResearch.GetResearchKey(PandaResearch.TimeBetween), 0f))) * TimeCycle .SecondsPerHour; colony.SendUpdate(); } } return(update); }
public void AddXP(int npcID, string jobtype, Colony owner, ushort amount = 1) { AddXPAmount(npcID, jobtype, amount, owner); }
public static void OnUpdate() { Players.PlayerDatabase.ForeachValue(p => { var stockpile = Stockpile.GetStockPile(p); var colony = Colony.Get(p); var hasBandages = stockpile.Contains(TreatedBandage.Item.ItemIndex) || stockpile.Contains(Bandage.Item.ItemIndex); if (hasBandages) { foreach (var follower in colony.Followers) { if (follower.health < NPCBase.MaxHealth && !HealingOverTimeNPC.NPCIsBeingHealed(follower)) { var healing = false; if (NPCBase.MaxHealth - follower.health > TreatedBandage.INITIALHEAL) { stockpile.TryRemove(TreatedBandage.Item.ItemIndex); healing = true; ServerManager.SendAudio(follower.Position.Vector, GameLoader.NAMESPACE + ".Bandage"); var heal = new HealingOverTimeNPC(follower, TreatedBandage.INITIALHEAL, TreatedBandage.TOTALHOT, 5, TreatedBandage.Item.ItemIndex); } if (!healing) { stockpile.TryRemove(Bandage.Item.ItemIndex); healing = true; ServerManager.SendAudio(follower.Position.Vector, GameLoader.NAMESPACE + ".Bandage"); var heal = new HealingOverTimeNPC(follower, Bandage.INITIALHEAL, Bandage.TOTALHOT, 5, Bandage.Item.ItemIndex); } } } } if (_updateTime < Time.SecondsSinceStartDouble && TimeCycle.IsDay && p.IsConnected) { NPCBase lastNPC = null; foreach (var follower in colony.Followers) { if (lastNPC == null || Vector3.Distance(lastNPC.Position.Vector, follower.Position.Vector) > 15 && Random.NextBool()) { lastNPC = follower; ServerManager.SendAudio(follower.Position.Vector, GameLoader.NAMESPACE + ".TalkingAudio"); } } } var ps = PlayerState.GetPlayerState(p); if (ps.SettlersEnabled) { if (EvaluateSettlers(p) || EvaluateLaborers(p) || EvaluateBeds(p)) { colony.SendUpdate(); } } UpdateFoodUse(p); }); if (_updateTime < Time.SecondsSinceStartDouble && TimeCycle.IsDay) { _updateTime = Time.SecondsSinceStartDouble + 10; } }
public bool ShouldSpawn(Colony c, Vector2 distribution, double spawnRoll) { return(spawnRoll < distribution.y); }
public string GetDescription(Colony colony, Players.Player player) { return(LocalizationHelper.LocalizeOrDefault("BedsClose", player)); }
public void Link(Colony colony) { Colony = colony; new ColonyFriend(Colony).AddImprovement(this); }
public void colonyDeselected() { selectedColony.deselect(); this.selectedColony = null; }
public void Tick(Colony colony) { base.DoProduction(); }
public RoamingJob(IBlockJobSettings settings, Vector3Int position, ItemTypes.ItemType type, Colony colony) : base(settings, position, type, colony) { OriginalPosition = position; }
protected override void AllocateProduction() { Colony.GetInventory(ProductType).Add(ProductionAmount); }
public override void Live() { //default speed direction //Todo:change default movement //Todo:avoid obstacles //Todo:Fix food dump to colony Speed.X = -1000; //strength increase for speed if (FoodBag > 1 && Strength < 10) { EatFromBag(2, MotherNature.DigestionFor.Strength); } if (FoodBag >= FOOD_BAG_SIZE * 20) { System.Drawing.Point closestHill = MyColony.Hill[0]; //gets closest point to the base foreach (var h in MyColony.Hill) { if (Helpers.Distance(SDLocation, new System.Drawing.Point(h.X, h.Y)) < Helpers.Distance(SDLocation, new System.Drawing.Point(closestHill.X, closestHill.Y))) { closestHill = h; } } Logger.WriteLogFile( $"GreenFarmer distance to store{Helpers.Distance(SDLocation, new System.Drawing.Point(closestHill.X, closestHill.Y))}"); if (Helpers.Distance(SDLocation, new System.Drawing.Point(closestHill.X, closestHill.Y)) < 2) { Logger.WriteLogFile("GreenWorker dumped food"); Colony.DumpFood(this); } //returns to the colony when full MoveToward(new System.Drawing.Point(closestHill.X, closestHill.Y)); } else { //Updates food list var greenFoods = FoodAroundMe(); //when food is spotted if (greenFoods.Count > 0) { Food closestFood = greenFoods[0]; foreach (Food f in greenFoods) { //Check which on is closer if (Helpers.Distance(f.Location, SDLocation) < Helpers.Distance(closestFood.Location, SDLocation)) { closestFood = f; } } //go toward the closest food MoveToward(closestFood.Location); if (Helpers.Distance(closestFood.Location, SDLocation) < PICKUP_REACH) { Pickup(closestFood); } } } Move(); }
public static void ActivateFacility(Colony colony) { colony.Facilities.ForEach(x => { switch (x) //make sure to actually add the facilities field to the colony class, afaik it only needs to be a list of FacilityType { case FacilityType.city: //income/econmics, population break; case FacilityType.taxAgency: //new tax bill 2017 break; case FacilityType.commercialPort: //io for commericial logistics break; case FacilityType.terraforming: //terraform planet break; case FacilityType.research: //advance percentage of research break; case FacilityType.mining: //mine resources break; case FacilityType.processing: //raw resources processing break; case FacilityType.agriculture: //feed the peeps break; case FacilityType.componentFactory: //build ship components break; case FacilityType.fighterFactory: //build fighters for the ships break; case FacilityType.ordnanceFactory: //build the explody things break; case FacilityType.militaryPort: //military related io, checkpoints break; case FacilityType.officer: //officer training break; case FacilityType.troop: //ground troop training break; case FacilityType.armor: //heavy armor unit training break; case FacilityType.crew: //space marines break; case FacilityType.forcefield: //planetary forcefield break; case FacilityType.bunker: //group units' defense augmentation break; case FacilityType.antiAir: //invasion defense break; case FacilityType.orbitalDefense: //orbital... defense break; case FacilityType.earlyWarning: //EA for inc ships break; default: break; } }); }
public bool TryDoCommand(Players.Player player, string chat) { var colony = Colony.Get(player); var counts = new Dictionary <MetalType, Dictionary <Armor.ArmorSlot, int> >(); var slots = new Dictionary <Armor.ArmorSlot, int>(); foreach (Armor.ArmorSlot slot in Armor.ArmorSlotEnum) { slots.Add(slot, 0); } foreach (MetalType metal in Enum.GetValues(typeof(MetalType))) { counts.Add(metal, new Dictionary <Armor.ArmorSlot, int>(slots)); } foreach (var npc in colony.Followers) { var inv = GetSettlerInventory(npc); foreach (var item in inv.Armor) { if (!item.Value.IsEmpty()) { var armor = Armor.ArmorLookup[item.Value.Id]; counts[armor.Metal][armor.Slot]++; } } } var state = PlayerState.GetPlayerState(player); var psb = new StringBuilder(); psb.Append("Player =>"); foreach (var armor in state.Armor) { if (armor.Value.IsEmpty()) { psb.Append($" {armor.Key}: None |"); } else { psb.Append($" {armor.Key}: {Armor.ArmorLookup[armor.Value.Id].Metal} | "); } } PandaChat.Send(player, psb.ToString()); foreach (var type in counts) { var sb = new StringBuilder(); sb.Append($"{type.Key} =>"); foreach (var slot in type.Value) { sb.Append($" {slot.Key}: {slot.Value} |"); } PandaChat.Send(player, sb.ToString()); } return(true); }
public BlueQueen(Point location, Point speed, Colony colony) : base(location, speed, colony) { }
public override string GetQuestTitle(Colony colony, Players.Player player) { return(HELPER.LocalizeOrDefault(nameof(FoodQuest), player)); }
public void Load(JObject node, IPandaQuest quest, Colony colony) { }
public static void SaveOffline(Players.Player p) { if (p.ID == null || p.ID.steamID == null) { return; } try { var folder = $"{GameLoader.GAMEDATA_FOLDER}/savegames/{ServerManager.WorldName}/players/NPCArchive/"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } var file = $"{folder}{p.ID.steamID.ToString()}.json"; if (!Configuration.OfflineColonies) { if (!JSON.Deserialize(file, out var followers, false)) { followers = new JSONNode(NodeType.Array); } followers.ClearChildren(); PandaLogger.Log(ChatColor.cyan, $"Player {p.ID.steamID} is disconnected. Clearing colony until reconnect."); var colony = Colony.Get(p); var copyOfFollowers = new List <NPCBase>(); foreach (var follower in colony.Followers) { JSONNode jobloc = null; if (follower.IsValid) { var job = follower.Job; if (job != null && job.KeyLocation != Vector3Int.invalidPos) { jobloc = (JSONNode)job.KeyLocation; job.NPC = null; follower.ClearJob(); } } if (follower.TryGetJSON(out var node)) { if (jobloc != null) { node.SetAs("JobPoS", jobloc); } ModLoader.TriggerCallbacks(ModLoader.EModCallbackType.OnNPCSaved, follower, node); followers.AddToArray(node); copyOfFollowers.Add(follower); } } JSON.Serialize(file, followers); foreach (var deadMan in copyOfFollowers) { deadMan.OnDeath(); } MonsterTracker.KillAllZombies(p); } } catch (Exception ex) { PandaLogger.LogError(ex); } }
public JObject Save(IPandaQuest quest, Colony colony) { return(null); }
private static bool EvaluateBeds(Players.Player p) { var update = false; try { if (!TimeCycle.IsDay && Time.SecondsSinceStartDouble > _nextbedTime) { if (p.IsConnected) { var colony = Colony.Get(p); var state = PlayerState.GetPlayerState(p); var remainingBeds = BedBlockTracker.GetCount(p) - colony.FollowerCount; var left = 0; if (remainingBeds >= 0) { state.NeedsABed = 0; } else { if (state.NeedsABed == 0) { state.NeedsABed = Time.SecondsSinceStartDouble + LOABOROR_LEAVE_HOURS; PandaChat.Send(p, SettlerReasoning.GetNeedBed(), ChatColor.grey); } if (state.NeedsABed != 0 && state.NeedsABed < TimeCycle.TotalTime) { foreach (var follower in colony.Followers) { if (follower.GetFieldValue <BedBlock, NPCBase>("bed") == null) { left++; NPCLeaving(follower); } } state.NeedsABed = 0; } if (left > 0) { PandaChat.Send(p, string.Concat(SettlerReasoning.GetNoBed(), string.Format(" {0} colonists have left your colony.", left)), ChatColor.red); update = true; } } colony.SendUpdate(); } _nextbedTime = Time.SecondsSinceStartDouble + Random.Next(5, 8) * TimeCycle.SecondsPerHour; } } catch (Exception ex) { PandaLogger.LogError(ex, "EvaluateBeds"); } return(update); }
internal ColonyController(MainGame game, Colony colony, bool readOnly, Player player) : base(colony, readOnly, game, player) { }
public void GetLocalizedValues(Players.Player player, Colony colony, int unlockedLevelCount, out string upgradeName, out string currentResults, out string nextResults) { upgradeName = _localization.LocalizeOrDefault("SkillChance", player); currentResults = string.Format(_localization.LocalizeOrDefault("SkillChancepct", player), GetSkillChance(colony) * 100); nextResults = string.Format(_localization.LocalizeOrDefault("SkillChancepct", player), GetSkillChance(colony, colony.GetUpgradeLevel(KEY) + 1) * 100); }
private void doColonization() { foreach (var project in this.game.States.ColonizationProjects) { var playerProc = this.game.Derivates.Of(project.Owner); bool colonyExists = this.game.States.Colonies.AtPlanet.Contains(project.Destination); var colonizers = this.game.States.Fleets.At[project.Destination.Star.Position].Where( x => { if (x.Owner != project.Owner || x.Missions.Count == 0) { return(false); } var mission = x.Missions.First.Value as ColonizationMission; return(mission != null && mission.Target == project.Destination); }); var arrivedPopulation = colonizers.SelectMany(x => x.Ships).Sum(x => playerProc.DesignStats[x.Design].ColonizerPopulation * x.Quantity); var colonizationTreshold = this.game.Statics.ColonyFormulas.ColonizationPopulationThreshold.Evaluate(null); if (!colonyExists && arrivedPopulation >= colonizationTreshold) { var colony = new Colony(0, project.Destination, project.Owner); var colonyProc = new ColonyProcessor(colony); colonyProc.CalculateBaseEffects(this.game.Statics, this.game.Derivates.Players.Of[colony.Owner]); foreach (var fleet in colonizers) { foreach (var shipGroup in fleet.Ships) { var shipStats = playerProc.DesignStats[shipGroup.Design]; var groupPopulation = shipStats.ColonizerPopulation * shipGroup.Quantity; var landingLimit = (long)Math.Ceiling((colonizationTreshold - colony.Population) / shipStats.ColonizerPopulation); var shipsLanded = Math.Min(shipGroup.Quantity, landingLimit); colonyProc.AddPopulation(shipsLanded * shipStats.ColonizerPopulation); foreach (var building in shipStats.ColonizerBuildings) { if (colony.Buildings.ContainsKey(building.Key)) { colony.Buildings[building.Key] += building.Value * shipGroup.Quantity; } else { colony.Buildings.Add(building.Key, building.Value * shipGroup.Quantity); } } shipGroup.Quantity -= shipsLanded; if (shipGroup.Quantity < 1) { fleet.Ships.PendRemove(shipGroup); } } fleet.Ships.ApplyPending(); if (fleet.Ships.Count == 0) { game.States.Fleets.PendRemove(fleet); } } game.States.Fleets.ApplyPending(); this.game.States.Colonies.Add(colony); this.game.Derivates.Colonies.Add(colonyProc); if (this.game.States.Stellarises.At[project.Destination.Star].All(x => x.Owner != project.Owner)) { var stellaris = new StellarisAdmin(project.Destination.Star, project.Owner); this.game.States.Stellarises.Add(stellaris); this.game.Derivates.Stellarises.Add(new StellarisProcessor(stellaris)); } } if (colonyExists || !colonyExists && arrivedPopulation >= colonizationTreshold) { project.Owner.Orders.ColonizationOrders.Remove(project.Destination); this.game.States.ColonizationProjects.PendRemove(project); } } this.game.States.ColonizationProjects.ApplyPending(); }
public bool AppliesToColony(Colony colony) { return(true); }
/// <summary> /// Reads a new simulation-state out of stream. /// </summary> /// <returns>New simulation-state or null, if stream is over</returns> public SimulationState Read() { // if stream is at his end, return null if (complete) { return(null); } // first block have to be a frame-start ISerializable block; BlockType blockType = serializer.Read(out block); // detect stream-end if (blockType == BlockType.StreamEnd) { complete = true; return(null); } // unexpected block-type if (blockType != BlockType.FrameStart) { throw new InvalidOperationException( string.Format( CultureInfo.CurrentCulture, Resource.AntvideoReaderInvalidBlockType, blockType)); } // block-loop while (blockType != BlockType.FrameEnd) { blockType = serializer.Read(out block); switch (blockType) { case BlockType.Ant: Ant ant = (Ant)block; antList.Add(ant.Id, ant); break; case BlockType.Anthill: Anthill anthill = (Anthill)block; anthillList.Add(anthill.Id, anthill); break; case BlockType.AntLost: Lost antLost = (Lost)block; antList.Remove(antLost.Id); break; case BlockType.AntUpdate: AntUpdate antUpdate = (AntUpdate)block; antList[antUpdate.Id].Update(antUpdate); break; case BlockType.Bug: Bug bug = (Bug)block; bugList.Add(bug.Id, bug); break; case BlockType.BugLost: Lost bugLost = (Lost)block; bugList.Remove(bugLost.Id); break; case BlockType.BugUpdate: BugUpdate bugUpdate = (BugUpdate)block; bugList[bugUpdate.Id].Update(bugUpdate); break; case BlockType.Caste: Caste caste = (Caste)block; casteList[caste.ColonyId].Add(caste.Id, caste); break; case BlockType.Team: Team team = (Team)block; teamList.Add(team.Id, team); colonyList.Add(team.Id, new Dictionary <int, Colony>()); break; case BlockType.Colony: Colony colony = (Colony)block; colonyList[colony.TeamId].Add(colony.Id, colony); casteList.Add(colony.Id, new Dictionary <int, Caste>()); break; case BlockType.ColonyUpdate: ColonyUpdate colonyUpdate = (ColonyUpdate)block; colonyList[colonyUpdate.TeamId][colonyUpdate.Id].Update(colonyUpdate); break; case BlockType.Frame: frame = (Frame)block; break; case BlockType.FrameUpdate: FrameUpdate frameUpdate = (FrameUpdate)block; frame.Update(frameUpdate); break; case BlockType.Fruit: Fruit fruit = (Fruit)block; fruitList.Add(fruit.Id, fruit); break; case BlockType.FruitLost: Lost fruitLost = (Lost)block; fruitList.Remove(fruitLost.Id); break; case BlockType.FruitUpdate: FruitUpdate fruitUpdate = (FruitUpdate)block; fruitList[fruitUpdate.Id].Update(fruitUpdate); break; case BlockType.Marker: Marker marker = (Marker)block; markerList.Add(marker.Id, marker); break; case BlockType.MarkerLost: Lost markerLost = (Lost)block; markerList.Remove(markerLost.Id); break; case BlockType.MarkerUpdate: MarkerUpdate markerUpdate = (MarkerUpdate)block; markerList[markerUpdate.Id].Update(markerUpdate); break; case BlockType.Sugar: Sugar sugar = (Sugar)block; sugarList.Add(sugar.Id, sugar); break; case BlockType.SugarLost: Lost sugarLost = (Lost)block; sugarList.Remove(sugarLost.Id); break; case BlockType.SugarUpdate: SugarUpdate sugarUpdate = (SugarUpdate)block; sugarList[sugarUpdate.Id].Update(sugarUpdate); break; } } // Detect streamend if ((BlockType)serializer.Peek() == BlockType.StreamEnd) { complete = true; } // Interpolate all elements and buildup state frame.Interpolate(); SimulationState state = frame.GenerateState(); foreach (Bug bug in bugList.Values) { bug.Interpolate(); state.BugStates.Add(bug.GenerateState()); } foreach (Fruit fruit in fruitList.Values) { fruit.Interpolate(); state.FruitStates.Add(fruit.GenerateState()); } foreach (Sugar sugar in sugarList.Values) { sugar.Interpolate(); state.SugarStates.Add(sugar.GenerateState()); } foreach (Team team in teamList.Values) { TeamState teamState = team.GenerateState(); state.TeamStates.Add(teamState); foreach (Colony colony in colonyList[team.Id].Values) { colony.Interpolate(); ColonyState colonyState = colony.GenerateState(); teamState.ColonyStates.Add(colonyState); foreach (Caste caste in casteList[colony.Id].Values) { colonyState.CasteStates.Add(caste.GenerateState()); } foreach (Anthill anthill in anthillList.Values) { if (anthill.ColonyId == colony.Id) { colonyState.AnthillStates.Add(anthill.GenerateState()); } } foreach (Ant ant in antList.Values) { if (ant.ColonyId == colony.Id) { ant.Interpolate(); colonyState.AntStates.Add(ant.GenerateState()); } } foreach (Marker marker in markerList.Values) { if (marker.ColonyId == colony.Id) { marker.Interpolate(); colonyState.MarkerStates.Add(marker.GenerateState()); } } } } // deliver return(state); }
public string GetDescription(Colony colony, Players.Player player) { return(LocalizationHelper.LocalizeOrDefault("DirtyToilets", player)); }
public void setAttacker(Colony attacker) { this.attacker = attacker; }
public OnClickTotemPositioner(Coord coord, Colony colony) { Coord = coord; Colony = colony; }
public void SetColonyComponent(Colony colony) { this.colony = colony; }