public bool Set(string playerId, Wabe wabe, WabeField field, out string error) { if (wabe.X > GameMap.Wabes.GetLength(0) || wabe.X < 0) { throw new IndexOutOfRangeException("x"); } if (wabe.Y > GameMap.Wabes.GetLength(1) || wabe.Y < 0) { throw new IndexOutOfRangeException("y"); } if (CurrentPlayer.Id != playerId) { error = "You aren't the current player"; return(false); } if (wabe.Owner != null && wabe.Owner.Id != playerId) { error = "This wabe is already owned by another player"; return(false); } if (!_executedFirstPlace[CurrentPlayer]) { _executedFirstPlace[CurrentPlayer] = true; } wabe.Set(CurrentPlayer, field); error = null; CurrentPlayer = Players.NextOfPlayer(CurrentPlayer, _isOut); return(true); }
private Texture2D SelectTextureFromField(WabeField field) { switch (field.Type) { case WabeFieldType.Unpowered: return(ResourceManager.GetResource <Texture2D>("Unpowered")); case WabeFieldType.Powered: return(ResourceManager.GetResource <Texture2D>("Powered")); case WabeFieldType.Unused: case WabeFieldType.Center: return(ResourceManager.GetResource <Texture2D>("Unowned")); default: return(null); } }