private void txtStone_TextChanged(object sender, TextChangedEventArgs e) { try { int newValue = Convert.ToInt32(txtStone.Text); switch (SelectedPlayer) { case enmPlayers.Blue: bluePlayer.Stone = newValue; break; case enmPlayers.Red: redPlayer.Stone = newValue; break; case enmPlayers.Green: greenPlayer.Stone = newValue; break; case enmPlayers.Purple: purplePlayer.Stone = newValue; break; } } catch { SelectedPlayer = SelectedPlayer; } }
public void SelectPlayer(enmPlayers player) { if (player == enmPlayers.None) { return; } SelectedPlayer = player; }
public SpriteAgent(enmPlayers owner, enmAgentType spriteType) { InitializeComponent(); Owner = owner; SpriteType = spriteType; setSprite(); }
public CollissionHandler(Agent agent, enmAgentType type) { owner = agent.owner; location = agent.location; agentName = agent.ID; agentType = type; collided = false; collidedWith = ""; }
/*This constructor gets called whenever an Agent is added to the game, no matter its type*/ public Agent(string _ID, int _goldUpkeepCost, int _foodUpkeepCost, string _location, enmPlayers _owner) { ID = _ID; goldUpkeepCost = _goldUpkeepCost; foodUpkeepCost = _foodUpkeepCost; location = _location; owner = _owner; inheritedSetUp(); //this calls the function which executes code unique for each agent type }
public Player getPlayer(enmPlayers color) { foreach (Player player in players) { if (player.color == color) { return(player); } } return(null); }
/*The following function changes who the selected player is*/ private void btnPlayer_Click(object sender, RoutedEventArgs e) { if (SelectedPlayer == enmPlayers.Purple) { SelectedPlayer = enmPlayers.Blue; } else { SelectedPlayer++; } }
public void AddNodeToList(string name, int nodeType, enmPlayers owner, int defenseLevel, int incomeLevel, double x, double y, List <String> listOfConnections) { Node node = new Node(); node.Name = name; node.setNodeTypeByIndex(nodeType); node.Owner = owner; node.DefenseLevel = defenseLevel; node.IncomeLevel = incomeLevel; node.nodeControl.SetValue(Canvas.LeftProperty, x); node.nodeControl.SetValue(Canvas.TopProperty, y); foreach (string connection in listOfConnections) { node.addConnection(connection); } nodeList.Add(node); }
public void setPlayerData(enmPlayers color, int gold, int food, int stone, int agentCounter, List <Scout> Scouts, List <Assassin> Assassins, List <Steward> Stewards, List <Commander> Commanders, List <Army> Armies) { foreach (Player player in players) { if (player.color != color) { continue; } player.Gold = gold; player.Food = food; player.Stone = stone; player.AgentCounter = agentCounter; player.Scouts = Scouts; player.Assassins = Assassins; player.Stewards = Stewards; player.Commanders = Commanders; player.Armies = Armies; break; } }
/*The following function sets up the icon of the selected agent. By using the ability to convert an enumeration into a * string, the number of lines of code is greatly reduced and all conditionals are unnecessary*/ public void setIcon(enmPlayers color, enmAgentType type) { imgSprite.Source = new BitmapImage(new Uri("Agents/Sprite" + type.ToString() + color.ToString() + ".png", UriKind.RelativeOrAbsolute)); }
public AgentControl(enmPlayers color, enmAgentType type) { InitializeComponent(); Selected = false; setIcon(color, type); }
public Player(enmPlayers _color) { color = _color; }
public AgentPlaceholder(string ID, int goldCost, int foodCost, string location, enmPlayers player) : base(ID, goldCost, foodCost, location, player) { }
public void refresh() { SelectedPlayer = SelectedPlayer; }
public Steward(string ID, int goldCost, int foodCost, string location, enmPlayers player) : base(ID, goldCost, foodCost, location, player) { }
public Assassin(string ID, int goldCost, int foodCost, string location, enmPlayers player) : base(ID, goldCost, foodCost, location, player) { }
public Commander(string ID, int goldCost, int foodCost, string location, enmPlayers player) : base(ID, goldCost, foodCost, location, player) { }