Example #1
0
        public void MakeResources()
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load("Resources.xml");
            XmlNodeList elemList = xmlDoc.GetElementsByTagName("resource");

            Console.WriteLine("Number of resources: {0}", elemList.Count);
            for (int i = 0; i < elemList.Count; i++)
            {
                var resource = new Agent.Resource();
                Console.WriteLine("Adding resource no. {0}", i);
                resource.type = elemList[i].Attributes["type"].Value[0];
                Console.WriteLine("Resource type: {0}", resource.type);
                resource.name   = elemList[i].Attributes["name"].Value;
                resource.weight = int.Parse(elemList[i].Attributes["weight"].Value);
                String resType = elemList[i].Attributes["resourceType"].Value;
                if (resType == "wood")
                {
                    resource.resourceType = Agent.ResourceType.wood;
                }

                resourcesList.Add(resource);
            }
        }
Example #2
0
 public void Kill()
 {
     if (kindOfAgentToKill == FindEntity.KindOfEntity.mapEntity)
     {
         if (map[agentToKill.X, agentToKill.Y].mapEntities.family == "wood")
         {
             map[agentToKill.X, agentToKill.Y].mapEntities = new Agent.MapEntity();
             var pileOfWood = new Agent.Resource(Agent.ResourceType.wood);
             pileOfWood.stackSize = 40;
             spawner.SpawnItem(agentToKill, pileOfWood, map);
         }
     }
 }
Example #3
0
 public ResourceRequirement()
 {
     this.resource = new Agent.Resource();
     this.amount   = 0;
 }