public void UpdateTerrain(int player, Terrain ter) { switch (player) { case 0: Background = new SolidColorBrush(Color.FromRgb(255, 128, 128)); break; case 1: Background = new SolidColorBrush(Color.FromRgb(128, 128, 255)); break; case 2: Background = new SolidColorBrush(Color.FromRgb(128, 255, 128)); break; default: Background = new SolidColorBrush(Color.FromRgb(128, 128, 128)); break; } if (ter == Terrain.Outside) { Opacity = 0.3; } else { Opacity = 1; } switch (ter) { case Terrain.AttackTower: TerrainImage.Source = attack[player]; break; case Terrain.Bridge: TerrainImage.Source = bridge[player]; break; case Terrain.Excavator: TerrainImage.Source = excavator[player]; break; case Terrain.Hole: TerrainImage.Source = hole[0]; break; case Terrain.House: TerrainImage.Source = house[player]; break; case Terrain.Initial: TerrainImage.Source = initial[player]; break; case Terrain.RobotMaker: TerrainImage.Source = robotmaker[player]; break; case Terrain.Town: TerrainImage.Source = town[player]; break; default: TerrainImage.Source = null; break; } }
public void Build(int x, int y, Terrain building) { if (IsFinish || IsBuild || IsMove) throw new Exception(); if (parent.Field[x, y].Player != Player) throw new Exception(); if (!parent.Field.Build(new Point { X = x, Y = y }, building, ref parent.ExtraPoint[parent.Player])) throw new Exception(); IsBuild = true; }
private string GenerateBuildingCode(Terrain building) { switch (building) { case Terrain.Initial: return "initial"; case Terrain.RobotMaker: return "robotmaker"; case Terrain.AttackTower: return "tower"; case Terrain.Excavator: return "excavator"; case Terrain.Bridge: return "bridge"; case Terrain.House: return "house"; case Terrain.Town: return "town"; default: throw new Exception(); } }
public void Build(int x, int y, Terrain building) { string temp = GenerateBuildingCode(building); parent.ToRedress(ref x, ref y); Console.WriteLine("build {0} {1} {2}", x, y, temp); IsBuild = true; }