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;
 }
예제 #3
0
        public SpriteAgent(enmPlayers owner, enmAgentType spriteType)
        {
            InitializeComponent();

            Owner      = owner;
            SpriteType = spriteType;

            setSprite();
        }
예제 #4
0
 public CollissionHandler(Agent agent, enmAgentType type)
 {
     owner        = agent.owner;
     location     = agent.location;
     agentName    = agent.ID;
     agentType    = type;
     collided     = false;
     collidedWith = "";
 }
예제 #5
0
        /*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
        }
예제 #6
0
 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++;
     }
 }
예제 #8
0
        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);
        }
예제 #9
0
 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;
     }
 }
예제 #10
0
 /*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));
 }
예제 #11
0
 public AgentControl(enmPlayers color, enmAgentType type)
 {
     InitializeComponent();
     Selected = false;
     setIcon(color, type);
 }
예제 #12
0
 public Player(enmPlayers _color)
 {
     color = _color;
 }
예제 #13
0
 public AgentPlaceholder(string ID, int goldCost, int foodCost, string location, enmPlayers player)
     : base(ID, goldCost, foodCost, location, player)
 {
 }
예제 #14
0
 public void refresh()
 {
     SelectedPlayer = SelectedPlayer;
 }
예제 #15
0
 public Steward(string ID, int goldCost, int foodCost, string location, enmPlayers player)
     : base(ID, goldCost, foodCost, location, player)
 {
 }
예제 #16
0
 public Assassin(string ID, int goldCost, int foodCost, string location, enmPlayers player)
     : base(ID, goldCost, foodCost, location, player)
 {
 }
예제 #17
0
 public Commander(string ID, int goldCost, int foodCost, string location, enmPlayers player)
     : base(ID, goldCost, foodCost, location, player)
 {
 }