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 = ""; }
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); }
/*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); }