예제 #1
0
        public SpriteAgent(enmPlayers owner, enmAgentType spriteType)
        {
            InitializeComponent();

            Owner      = owner;
            SpriteType = spriteType;

            setSprite();
        }
예제 #2
0
 public CollissionHandler(Agent agent, enmAgentType type)
 {
     owner        = agent.owner;
     location     = agent.location;
     agentName    = agent.ID;
     agentType    = type;
     collided     = false;
     collidedWith = "";
 }
예제 #3
0
        public void Add(Agent agent, enmAgentType type)
        {
            CollissionHandler addition = new CollissionHandler(agent, type);

            //check for collissions
            foreach (CollissionHandler occupation in occupations)
            {
                if (agent.owner == occupation.owner)
                {
                    continue;
                }
                if (string.Equals(agent.location, occupation.location))
                {
                    occupation.collided     = true;
                    occupation.collidedWith = agent.ID;
                    addition.collided       = true;
                    addition.collidedWith   = occupation.agentName;
                    collissionsOccurred++;
                    break;
                }
            }

            occupations.Add(addition);
        }
예제 #4
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));
 }
예제 #5
0
 public AgentControl(enmPlayers color, enmAgentType type)
 {
     InitializeComponent();
     Selected = false;
     setIcon(color, type);
 }