public Team(string aiId, int teamId, Queen queen, AntAI ai, Color color) { this.aiId = aiId; this.teamId = teamId; this.ai = ai; this.queen = queen; this.workers = new List <Worker>(); this.eggs = new List <Egg>(); this.color = color; }
//Enter Water void OnTriggerEnter(Collider collision) { if (collision.GetComponent <DamageArea>())//When the Character's Damage Area Trigger Touches the Water Swim Trigger { if (collision.GetComponentInParent <AntAI>()) { AntScript = collision.GetComponentInParent <AntAI>(); AntScript.inWater = true; whichScript = 1; } else if (collision.GetComponentInParent <DemigodAI>()) { DemigodScript = collision.GetComponentInParent <DemigodAI>(); DemigodScript.inWater = true; whichScript = 2; } else if (collision.GetComponentInParent <MinotaurAI>()) { MinotaurScript = collision.GetComponentInParent <MinotaurAI>(); MinotaurScript.inWater = true; whichScript = 3; } else if (collision.GetComponentInParent <MedusaAI>()) { MedusaScript = collision.GetComponentInParent <MedusaAI>(); MedusaScript.inWater = true; whichScript = 4; } else if (collision.GetComponentInParent <PlayerHealth>())//1 { PlayerScript = collision.GetComponentInParent <PlayerHealth>(); PlayerSwim = collision.GetComponentInParent <Swimming>(); PlayerScript.inWater = true; PlayerSwim.inWater = true; whichScript = 5; } else if (collision.GetComponentInParent <ChimeraAI>()) { ChimeraScript = collision.GetComponentInParent <ChimeraAI>(); ChimeraScript.inWater = true; whichScript = 6; } if (whichScript == 5)//Why is this here??????????????????????? Why not just put these statements in the *1 above? Same below in Trigger Exit { PlayerSwim.whatToDo(true); underwaterAudio.Play(); } } }
private void MakeAntThink(Ant ant, AntAI ai) { // Inserts the ant randomly in the next turn InsertAntInNextRandomList(ant); // Gets all the pheromones on the current tile List <PheromoneDigest> pheromones = PheromoneDigest.ListFromDescriptorList(pheromoneMaps[ant.team.teamId][ant.gameCoordinates.x][ant.gameCoordinates.y]); // Gets all the surrounding pheromones Dictionary <HexDirection, List <PheromoneDigest> > pheromoneGroups = new Dictionary <HexDirection, List <PheromoneDigest> >(); for (HexDirection direction = (HexDirection)1; (int)direction < 7; direction++) { Vector2Int currentCoord = CoordConverter.MoveHex(ant.gameCoordinates, direction); if (!CheckCoordinatesValidity(currentCoord)) { pheromoneGroups.Add(direction, PheromoneDigest.ListFromDescriptorList(null)); } else { pheromoneGroups.Add(direction, PheromoneDigest.ListFromDescriptorList(pheromoneMaps[ant.team.teamId][currentCoord.x][currentCoord.y])); } } TurnInformation info = new TurnInformation( terrain[ant.gameCoordinates.x][ant.gameCoordinates.y].tile.Type, ant.pastTurn != null ? ant.pastTurn.DeepCopy() : null, ant.mindset, pheromones, pheromoneGroups, ValueConverter.Convert(ant.energy), ValueConverter.Convert(ant.hp), ValueConverter.Convert(ant.carriedFood), ant.analyseReport, ant.communicateReport, ant.eventInputs, ant.GetInstanceID() ); if (ant.Type == AntType.QUEEN) { ant.decision = ai.OnQueenTurn(info); } else if (ant.Type == AntType.WORKER) { ant.decision = ai.OnWorkerTurn(info); } else { Debug.LogError("This ant has an unknown type!"); } if (ant.decision == null) { ant.decision = new Decision(ant.mindset, ChoiceDescriptor.ChooseNone(), pheromones); } ant.displayDirection = ant.decision.choice.direction; ant.ClearInputs(); // The inputs are flushed here so they can be filled up by the resolution of the actions }