/// <summary> /// Gets the <see cref="AIAction" /> for the specified <see cref="GameState" />. /// </summary> /// <param name="gameState">The state of the game.</param> /// <returns> /// The <see cref="AIAction" /> for the specified <see cref="GameState" />. /// </returns> public AIAction GetAction(GameState gameState) { if (gameState.Step == 0 || MyTeam == null) { Ball = new Ball(gameState.Ball); MyTeam = new Team(GetParameters(), this); OpponentTeam = new Team(GetParameters(), this); // expect opponent to have the same parameters } // AI entities (wrappers of SimulationEntities) are set accordingly Ball.LoadState(gameState); OpponentTeam.LoadState(gameState, false); // must be loaded before my team! MyTeam.LoadState(gameState, true); SupportPositionsManager.Update(); // new action var currentAction = new AIAction { Step = gameState.Step, PlayerActions = MyTeam.GetActions() }; return(currentAction); }
public void Register(string msg, OpponentTeam team, MethodInfo method) { if (!registrations.ContainsKey(msg)) { registrations[msg] = new Tuple <OpponentTeam, MethodInfo>(team, method); } }
public override void Awake() { pokeTeam = this.gameObject.GetComponent <OpponentTeam> (); Debug.Log(pokeTeam.gameObject.name); if (pokeTeam.pokeTeam.Count == 0) { PokemonBase pokepon = PokemonBase.RandomPokemon(DebugNumber()); pokeTeam.pokeTeam.Add(pokepon); //DEBUG// } //PokemonBase sentretje = PokemonBase.RandomPokemon (163); //pokeTeam.pokeTeam.Add(sentretje); //DEBUG// activeSprite = gameObject.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer> (); activePokemon = pokeTeam.pokeTeam [0]; activeSprite.sprite = Resources.Load <Sprite> ("Sprites/Front/Normal/" + activePokemon.DexNum); }
public void ClearAll() { Active = true; foreach (PlayerMobile opponent in OpponentTeam) { opponent.IsInChallenge = false; } foreach (PlayerMobile challenger in ChallengeTeam) { challenger.IsInChallenge = false; } ChallengeTeam.Clear(); ChallengerDead.Clear(); OpponentTeam.Clear(); OpponentDead.Clear(); }
public void ClearAll() { Active = true; ArrayList Players = new ArrayList(); foreach (PlayerMobile opponent in OpponentTeam) { opponent.IsInChallenge = false; Players.Add(opponent); opponent.CloseGump(typeof(ReportMurdererGump)); } foreach (PlayerMobile challenger in ChallengeTeam) { challenger.IsInChallenge = false; Players.Add(challenger); challenger.CloseGump(typeof(ReportMurdererGump)); } ChallengeTeam.Clear(); ChallengerDead.Clear(); OpponentTeam.Clear(); OpponentDead.Clear(); new InvulTimer(Players).Start(); }
public void RemoveOpponentPlayer(PlayerMobile player) { OpponentTeam.Remove(player); }
public void AddOpponentPlayer(PlayerMobile player) { OpponentTeam.Add(player); }
public void SyncGame() { string[] inputs; inputs = Console.ReadLine().Split(' '); MyTeam.Update(int.Parse(inputs[0]), int.Parse(inputs[1])); inputs = Console.ReadLine().Split(' '); OpponentTeam.Update(int.Parse(inputs[0]), int.Parse(inputs[1])); SetSnaffleStillExistToFalse(); int nb_entities = int.Parse(Console.ReadLine()); // number of entities still in game for (int i = 0; i < nb_entities; i++) { inputs = Console.ReadLine().Split(' '); int entityId = int.Parse(inputs[0]); string entityType = inputs[1]; // "WIZARD", "OPPONENT_WIZARD" or "SNAFFLE" or "BLUDGER" Vector2 position = new Vector2(int.Parse(inputs[2]), int.Parse(inputs[3])); Vector2 velocity = new Vector2(int.Parse(inputs[4]), int.Parse(inputs[5])); int state = int.Parse(inputs[6]); Entity actualElement = this.Entities.Find(e => e.Id == entityId); switch (entityType) { case "WIZARD": if (actualElement is Wizard e) { e.Update(position, velocity, Convert.ToBoolean(state)); } else { this.Entities.Add( new Wizard(entityId, entityType, position, velocity, Convert.ToBoolean(state))); } break; case "OPPONENT_WIZARD": if (actualElement is Wizard oe) { oe.Update(position, velocity, Convert.ToBoolean(state)); } else { this.Entities.Add( new Wizard(entityId, entityType, position, velocity, Convert.ToBoolean(state))); } break; case "SNAFFLE": if (actualElement is Snaffle s) { s.Update(position, velocity, Convert.ToBoolean(state)); } else { this.Entities.Add( new Snaffle(entityId, entityType, position, velocity, Convert.ToBoolean(state))); } break; case "BLUDGER": if (actualElement is Bludger b) { b.Update(position, velocity, state); } else { this.Entities.Add( new Bludger(entityId, entityType, position, velocity, state)); } break; default: break; } } this.Entities = this.Entities.OrderBy(e => e.Id).ToList(); ComputeAdditionalInfos(); }