コード例 #1
0
        /// <summary>
        /// Returns a reference to an equipment agent based on the map object passed. Will assign the map cells position to the created agent.
        /// </summary>
        /// <param name="mapObject"></param>
        /// <param name="mapCell"></param>
        /// <returns></returns>
        private Equipment CreateEquipmentFromEquipmentObjectSubtype(MapObject mapObject, MapCell mapCell)
        {
            if (mapObject == null)
            {
                throw new ArgumentNullException("mapObject");
            }
            if (mapCell == null)
            {
                throw new ArgumentNullException("mapCell");
            }

            Equipment       equipment       = null;
            EquipmentObject equipmentObject = (EquipmentObject)mapObject;

            switch (equipmentObject.Subtype)
            {
            case EquipmentObjectType.SnackMachine:
                equipment = agentFactory.CreateSnackMachine(TimeSpan.Zero, mapCell.WorldPosition);
                break;

            case EquipmentObjectType.SodaMachine:
                equipment = agentFactory.CreateSodaMachine(TimeSpan.Zero, mapCell.WorldPosition);
                break;

            case EquipmentObjectType.OfficeDesk:
                equipment = agentFactory.CreateOfficeDesk(TimeSpan.Zero, mapCell.WorldPosition);
                break;

            case EquipmentObjectType.WaterFountain:
                equipment = agentFactory.CreateWaterFountain(TimeSpan.Zero, mapCell.WorldPosition);
                break;
            }

            return(equipment);
        }
コード例 #2
0
        private IEnumerable <IPurchasable> GetPurchasableEquipment()
        {
            List <IPurchasable> purchasableItems = new List <IPurchasable>
            {
                agentFactory.CreateSnackMachine(TimeSpan.Zero),
                agentFactory.CreateSodaMachine(TimeSpan.Zero),
                agentFactory.CreateWaterFountain(TimeSpan.Zero),
                agentFactory.CreateOfficeDesk(TimeSpan.Zero),
                agentFactory.CreateTrashBin(TimeSpan.Zero),
                agentFactory.CreateSnackMachine(TimeSpan.Zero),
                agentFactory.CreateSodaMachine(TimeSpan.Zero),
                agentFactory.CreateWaterFountain(TimeSpan.Zero),
                agentFactory.CreateOfficeDesk(TimeSpan.Zero),
                agentFactory.CreateTrashBin(TimeSpan.Zero),
                agentFactory.CreateSodaMachine(TimeSpan.Zero),
                agentFactory.CreateWaterFountain(TimeSpan.Zero)
            };

            return(purchasableItems);
        }