private bool TryMakeTurn( int[,] fieldMap, PlayerSwitcherComponent switcher, Entity fieldEntity, Vector2 cursorPosition, TurnMadeComponent turn) { var position = fieldEntity.GetComponent <PositionComponent>(); var field = fieldEntity.GetComponent <FieldComponent>(); var map = field.Map; var location = (cursorPosition - position.Position) / (field.BlockSize + field.BlockInterval); var x = (int)Math.Floor(location.X); var y = (int)Math.Floor(location.Y); if (!this.IsInMap(map, x, y)) { return(false); } for (var index = 0; index < switcher.Players.Count; index++) { var otherTurns = switcher.Players[index]; if (map[x, y] == field.Map[otherTurns.PlayerX, otherTurns.PlayerY]) { var common = this.scene.FindEntity("Common"); common.GetComponent <CameraShakeComponent>().Shake(); return(true); } } turn.Color = map[x, y]; turn.TurnMade = true; return(true); }
public GreedyFloodItAI(TurnMadeComponent turn, PlayerSwitcherComponent switcher) : base(turn, switcher) { }