コード例 #1
0
        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;
            }
        }
コード例 #2
0
 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
ファイル: Agent.cs プロジェクト: lugerovac/Conquerors
        /*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
ファイル: App.xaml.cs プロジェクト: lugerovac/Conquerors
 public Player getPlayer(enmPlayers color)
 {
     foreach (Player player in players)
     {
         if (player.color == color)
         {
             return(player);
         }
     }
     return(null);
 }
コード例 #7
0
 /*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
ファイル: App.xaml.cs プロジェクト: lugerovac/Conquerors
 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
ファイル: Player.cs プロジェクト: lugerovac/Conquerors
 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
ファイル: Assassin.cs プロジェクト: lugerovac/Conquerors
 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)
 {
 }