Ejemplo n.º 1
0
 public static bool IsMapElementTypeCraftable(MapElementType type)
 {
     if (type == MapElementType.Plank)
         return true;
     else if (type == MapElementType.WoodBed)
         return true;
     else if (type == MapElementType.SteamEngine)
         return true;
     else if (type == MapElementType.Rod)
         return true;
     else if (type == MapElementType.Gear)
         return true;
     else if (type == MapElementType.Rail)
         return true;
     else if (type == MapElementType.IronBar)
         return true;
     else if (type == MapElementType.Fence)
         return true;
     else if (type == MapElementType.Beer)
         return true;
     else if (type == MapElementType.StoneBrick)
         return true;
     else if (type == MapElementType.IronTool)
         return true;
     else if (type == MapElementType.Meal)
         return true;
     else if (type == MapElementType.Arrow)
         return true;
     else if (type == MapElementType.Bullet)
         return true;
     return false;
 }
Ejemplo n.º 2
0
 public Cube(MapElementType type, Overlay overlay, WorldMap worldMap, Vector3Int position)
     : base(worldMap, position)
 {
     ElementType = type;
     Overlay = overlay;
     Solid = true;
 }
Ejemplo n.º 3
0
 public Cube(MapElementType type, Vector3Int position)
     : base(position)
 {
     ElementType = type;
     ElementEffect = MapElementEffect.Solid;
     Unconstructed = false;
 }
Ejemplo n.º 4
0
    public void WrapEagle(Transform eagle, MapElementType element /*, BuildSide side*/)
    {
        Vector2 eagleLocalPoint = eagle.localPosition;

        var Tilemap = ClassicGameManager.s_Instance.Tilemap;
        var Level   = Tilemap.parent;

        var material = GetMaterial(element);

        circleSide = new Vector2[]
        {
            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MAX, eagleLocalPoint.y + BUILD_THRESHOLD_MIN),
            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MAX, eagleLocalPoint.y - BUILD_THRESHOLD_MIN),

            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MAX, eagleLocalPoint.y + BUILD_THRESHOLD_MIN),
            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MAX, eagleLocalPoint.y - BUILD_THRESHOLD_MIN),

            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MIN, eagleLocalPoint.y + BUILD_THRESHOLD_MAX),
            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MIN, eagleLocalPoint.y + BUILD_THRESHOLD_MAX),

            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MIN, eagleLocalPoint.y - BUILD_THRESHOLD_MAX),
            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MIN, eagleLocalPoint.y - BUILD_THRESHOLD_MAX),

            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MAX, eagleLocalPoint.y - BUILD_THRESHOLD_MAX),
            new Vector2(eagleLocalPoint.x - BUILD_THRESHOLD_MAX, eagleLocalPoint.y + BUILD_THRESHOLD_MAX),
            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MAX, eagleLocalPoint.y - BUILD_THRESHOLD_MAX),
            new Vector2(eagleLocalPoint.x + BUILD_THRESHOLD_MAX, eagleLocalPoint.y + BUILD_THRESHOLD_MAX),
        };


        foreach (var point in circleSide)
        {
            var          eagleGlobalPoint = Level.TransformVector(point);
            Collider2D[] objects          = Physics2D.OverlapPointAll(eagleGlobalPoint);

            bool canbuild = objects.Length == 0;

            foreach (var obj in objects)
            {
                if (!obj.GetComponent <PlayerTank>() &&
                    !obj.GetComponent <EnemyTank>() &&
                    !obj.GetComponent <LevelBorder>() &&
                    !obj.GetComponent <Eagle>())
                {
                    Destroy(obj.gameObject);
                    canbuild = true;
                }
                else
                {
                    canbuild = false;
                }
            }

            if (canbuild && material != null)
            {
                Instantiate(material, Vector2.zero, Quaternion.identity, Tilemap)
                .transform.localPosition = point;
            }
        }
    }
Ejemplo n.º 5
0
 public CraftingOfAmmoTask(MapElementType type, int level, Tower tower)
 {
     Tower = tower;
     Type = type;
     Level = level;
     TaskType = TaskType.CraftingOfAmmo;
 }
Ejemplo n.º 6
0
 public MapElement(int x, int y, int height, MapElementType elementType)
 {
     this.x           = x;
     this.y           = y;
     this.height      = height;
     this.elementType = elementType;
 }
Ejemplo n.º 7
0
        public CraftingOfResourceTask(MapElementType type, int level)
        {
            Type = type;
            Level = level;
            TaskType = TaskType.CraftingOfResource;

            if (type == MapElementType.Plank)
            {
                GlobalJobType = GlobalJobType.Sawmill;
                DwarfDebug.DwarfDebugInfo.CraftingOfPlankTasks++;
            }
            else if (type == MapElementType.IronTool)
            {
                GlobalJobType = GlobalJobType.ToolMaking;
            }
            else if (type == MapElementType.IronBar)
                GlobalJobType = GlobalJobType.Smelting;
            else if (type == MapElementType.Beer)
                GlobalJobType = GlobalJobType.Brewing;
            else if (type == MapElementType.WhoolClowth)
                GlobalJobType = GlobalJobType.Weaving;
            else if (type == MapElementType.Meal)
                GlobalJobType = GlobalJobType.Cooking;
            else if (type == MapElementType.StoneBrick)
                GlobalJobType = GlobalJobType.Mason;
            else
            {
                throw new Exception("Unknown item");
            }
        }
Ejemplo n.º 8
0
        private static bool CustomFieldsMatch(UniFields fields1, UniFields fields2, MapElementType type)
        {
            // Collect non-UI fields
            UniFields filtered1 = new UniFields();
            UniFields filtered2 = new UniFields();

            foreach (string key in fields1.Keys)
            {
                if (!General.Map.FormatInterface.UIFields[type].ContainsKey(key))
                {
                    filtered1.Add(key, fields1[key]);
                }
            }

            foreach (string key in fields2.Keys)
            {
                if (!General.Map.FormatInterface.UIFields[type].ContainsKey(key))
                {
                    filtered2.Add(key, fields2[key]);
                }
            }

            if (filtered1.Keys.Count != filtered2.Keys.Count)
            {
                return(false);
            }
            return(AllFieldsMatch(filtered1, filtered2));
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Gets all available MapElementTypes. Returns an empty list if none found. It will never return null or a list with null elements.
        /// <p>The actual table names used in the queries are obtained from the tableNames dictionary.</p>
        /// <p><strong>Implementation Notes</strong></p>
        /// <ul type="disc">
        /// <li>Get instance of IDbConnection from ConnectionManager with&nbsp;this.connectionName</li>
        /// <li>Perform query to obtain all records from elementTypes</li>
        /// <li>For each retrieved record, construct a new MapElementType and fill it with the row info</li>
        /// <li>Perform query to obtain all rows from attributes whose owner_id is in the set of elementType IDs</li>
        /// <li>For each retrieved record, assemble it into a MapAttribute and add to the appropriate MapElementType</li>
        /// <li>Close connection and return the list of available MapElementTypes</li>
        /// </ul>             /// </summary>
        /// <exception>MapDataSourceException If there were errors during this operation</exception>
        /// <returns>List of available MapElementTypes</returns>
        public IList <MapElementType> DownloadElementTypes()
        {
            IList <MapElementType> result   = null;
            MapElementType         elemType = null;
            IDictionary <long, IList <MapAttribute> > attrsDict = null;
            IList <MapAttribute> attrs = null;
            MapAttribute         attr  = null;

            using (IDbConnection connection = CreateConnection("Sql1"))
            {
                connection.Open();

                using (IDataReader reader = Helper.ExecuteReader(connection, queryTextElementTypes))
                {
                    result = new List <MapElementType>();
                    while (reader.Read())
                    {
                        elemType       = new MapElementType();
                        elemType.Id    = reader.GetInt32(0);
                        elemType.Name  = reader.GetString(1);
                        elemType.Layer = reader.GetInt32(2);

                        result.Add(elemType);
                    }
                }
                attrsDict = new Dictionary <long, IList <MapAttribute> >();
                foreach (MapElementType type in result)
                {
                    if (attrsDict.ContainsKey(type.Id))
                    {
                        type.Attributes = attrsDict[type.Id];
                    }
                    else
                    {
                        using (IDataReader reader = Helper.ExecuteReader(connection, "SELECT * FROM attribs where owner_id = " + type.Id))
                        {
                            attrs = new List <MapAttribute>();
                            while (reader.Read())
                            {
                                attr             = new MapAttribute();
                                attr.Id          = reader.GetInt32(0);
                                attr.OwnerId     = reader.GetInt32(1);
                                attr.OwnerType   = reader.GetString(2);
                                attr.Type        = reader.GetString(3);
                                attr.Name        = reader.GetString(4);
                                attr.IntValue    = reader.GetInt32(5);
                                attr.StringValue = reader.GetValue(6) as string;
                            }
                            type.Attributes    = attrs;
                            attrsDict[type.Id] = attrs;
                        }
                    }
                }
            }


            // your code here
            return(result);
        }
Ejemplo n.º 10
0
 public WorldObject(Vector3Int position, MapElementType type, int level)
 {
     Id = Guid.NewGuid();
     Level = level;
     ElementType = type;
     Position = position;
     NeededForCrafting = new Dictionary<MapElementType, int>();
 }
Ejemplo n.º 11
0
        public CraftingOfAmmoTask(MapElementType type, int level, Tower tower)
        {
            Tower = tower;
            Type = type;
            Level = level;
            TaskType = TaskType.CraftingOfAmmo;

            if (type == MapElementType.Arrow)
                GlobalJobType = GlobalJobType.Arrowsmith;
        }
Ejemplo n.º 12
0
    private void setTyleForAllLayers(MapElementType pMapElement, Vector3Int pPosition)
    {
        setTyle(_tilemapGroundLayer, getFloorLayerTile(pMapElement), pPosition);
        setTyle(_tilemapPlayerAndBoxLayer, getPlayerAndBoxLayerTile(pMapElement), pPosition);

        if (isMapElementWithBox(pMapElement))
        {
            setBoxHolderTile(pMapElement == MapElementType.BOX_HOLDER_AND_BOX, pPosition);
        }
    }
Ejemplo n.º 13
0
        public GetBuildingMaterialTask(MapElementType obj, int level, Building building)
        {
            Building = building;
            Type = obj;
            Level = level;
            if (Type == MapElementType.Stone)
            {

            }
            TaskType = TaskType.GetBuildingMaterial;
        }
Ejemplo n.º 14
0
 private void SetItem(MapElementType type, int count)
 {
     if (_items.ContainsKey(type) == false)
     {
         if (count == 0)
             return;
         var guiItem = new WorldObjectItem(GetNextPosition());
         _items.Add(type, guiItem);
         AddGuiComponent(guiItem);
     }
     _items[type].SetCount(count);
     _items[type].SetItemName(NameHelper.GetNameOfWorldObject(type));
 }
Ejemplo n.º 15
0
    private bool isMapElementWithBox(MapElementType pMapElement)
    {
        switch (pMapElement)
        {
        case MapElementType.BOX_HOLDER:
        case MapElementType.BOX_HOLDER_AND_BOX:
        case MapElementType.BOX_HOLDER_AND_PLAYER:
            return(true);

        default:
            return(false);
        }
    }
Ejemplo n.º 16
0
        public static string GetNameOfWorldObject(MapElementType type)
        {
            if (type == MapElementType.IronBar)
                return "Iron Bar";
            if (type == MapElementType.IronOre)
                return "Iron Ore";
            if (type == MapElementType.IronTool)
                return "Iron Tool";
            if (type == MapElementType.Lumber)
                return "Lumber";

            return type.ToString();
            //throw new Exception("World object not registred");
        }
Ejemplo n.º 17
0
    private TileBase getPlayerAndBoxLayerTile(MapElementType pMapElement)
    {
        switch (pMapElement)
        {
        case MapElementType.BOX:
        case MapElementType.BOX_HOLDER_AND_BOX:
            return(_tileBox);

        case MapElementType.PLAYER:
        case MapElementType.BOX_HOLDER_AND_PLAYER:
            return(_tilePlayer);

        default:
            return(null);
        }
    }
Ejemplo n.º 18
0
        //mxd.
        public string GetElementName(MapElementType elementtype)
        {
            switch (elementtype)
            {
            case MapElementType.VERTEX:  return("vertex");

            case MapElementType.LINEDEF: return("linedef");

            case MapElementType.SIDEDEF: return("sidedef");

            case MapElementType.SECTOR:  return("sector");

            case MapElementType.THING:   return("thing");

            default: throw new NotSupportedException("Tried to get element name of unsupported map element type!");
            }
        }
Ejemplo n.º 19
0
        public GetBuildingMaterialTask(MapElementType obj, int level, Building building)
        {
            Building = building;
            Type = obj;
            Level = level;
            if (Type == MapElementType.Stone)
            {

            }
            if (Type == MapElementType.Plank)
            {
                DwarfDebugInfo.GetBuildingMaterialTasksCreatedPlank++;
            }
            TaskType = TaskType.GetBuildingMaterial;

            RegisterTask();
        }
Ejemplo n.º 20
0
    private TileBase getFloorLayerTile(MapElementType pMapElement)
    {
        switch (pMapElement)
        {
        case MapElementType.WALL:
            return(_tileWall);

        case MapElementType.GRASS:
        case MapElementType.BOX:
        case MapElementType.BOX_HOLDER:
        case MapElementType.PLAYER:
        case MapElementType.BOX_HOLDER_AND_BOX:
            return(_tileGrass);

        default:
            return(null);
        }
    }
Ejemplo n.º 21
0
    private GameObject GetMaterial(MapElementType element)
    {
        switch (element)
        {
        case MapElementType.Brick: return(ResourceManager.s_Instance.BrickPrefab);

        case MapElementType.Concrete: return(ResourceManager.s_Instance.ConcretePrefab);

        case MapElementType.Forest: return(ResourceManager.s_Instance.ForestPrefab);

        case MapElementType.Ice: return(ResourceManager.s_Instance.IcePrefab);

        case MapElementType.Water: return(ResourceManager.s_Instance.WaterPrefab);

        case MapElementType.Nothing:
        default: return(null);
        }
    }
Ejemplo n.º 22
0
        public static BuildingType WorkshopNeededToCraft(MapElementType t)
        {
            if (t == MapElementType.Plank)
                return BuildingType.Sawmill;

            if (t == MapElementType.Beer)
                return BuildingType.Brewery;

            else if (t == MapElementType.WoodBed)
                return BuildingType.CarpenterWorkshop;
            else if (t == MapElementType.WoodDoor)
                return BuildingType.CarpenterWorkshop;
            else if (t == MapElementType.WoodTable)
                return BuildingType.CarpenterWorkshop;
            else if (t == MapElementType.WoodChair)
                return BuildingType.CarpenterWorkshop;
            else if (t == MapElementType.SteamEngine)
                return BuildingType.MechanicWorkshop;
            else if (t == MapElementType.IronBar)
                return BuildingType.Furnace;
            else if (t == MapElementType.Rail)
                return BuildingType.Metalsmith;
            else if (t == MapElementType.Fence)
                return BuildingType.CarpenterWorkshop;
            else if (t == MapElementType.StoneBrick)
                return BuildingType.MasonWorkshop;
            else if (t == MapElementType.IronTool)
                return BuildingType.ToolSmith;
            else if (t == MapElementType.Meal)
                return BuildingType.Kitchen;
            else if (t == MapElementType.Arrow)
                return BuildingType.Arrowsmith;
            else if (t == MapElementType.Bullet)
                return BuildingType.Bulletsmith;
            else if (t == MapElementType.WhoolClowth)
                return BuildingType.Weaver;

            throw new Exception("No workshop found");
        }
    private void onMoveAttempt(Vector2Int pDirection)
    {
        Vector2Int     lCurrentPlayerPosition = _levelController.PlayerPosition;
        Vector2Int     lTargetPlayerPosition  = lCurrentPlayerPosition + pDirection;
        MapElementType lTargetedTile          = _levelController.GetElementAtIndex(lTargetPlayerPosition.x, lTargetPlayerPosition.y);

        switch (lTargetedTile)
        {
        case MapElementType.BOX_HOLDER:
        case MapElementType.GRASS:
            _levelController.MovePlayer(lTargetPlayerPosition);
            break;

        case MapElementType.BOX:
        case MapElementType.BOX_HOLDER_AND_BOX:
            tryBoxPush(lTargetPlayerPosition + pDirection, lTargetPlayerPosition);
            break;

        default:
            AudioManager.Instance.Play("CantMove");
            break;
        }
    }
Ejemplo n.º 24
0
        protected MapElementProperties(UniFields other, MapElementType type)
        {
            // Should we bother?
            if (!General.Map.UDMF)
            {
                return;
            }

            // Copy source fields except the ones controlled by the UI
            fields      = new UniFields();
            uifields    = new UniFields();
            elementtype = type;
            foreach (KeyValuePair <string, UniValue> group in other)
            {
                if (General.Map.FormatInterface.UIFields[elementtype].ContainsKey(group.Key))
                {
                    uifields.Add(group.Key, new UniValue(group.Value));
                }
                else
                {
                    fields.Add(group.Key, new UniValue(group.Value));
                }
            }
        }
Ejemplo n.º 25
0
 public int GetNumberOfNeededBuildingMaterial(MapElementType type)
 {
     if (DepositedWorldObjects.ContainsKey(type) == false)
         return NeededForConstruction[type];
     else
         return NeededForConstruction[type] - DepositedWorldObjects[type].Count;
 }
Ejemplo n.º 26
0
        public List<WorldObject> GetDepositedWorldObjects(MapElementType t, int level)
        {
            List<WorldObject> objs = new List<WorldObject>();

            foreach (WorldObject obj in DepositedWorldObjects[t])
            {
                if (obj.Level == level)
                    objs.Add(obj);
            }

            return objs;
        }
Ejemplo n.º 27
0
 public int GetNumberOfDepositedMaterial(MapElementType type, int level)
 {
     int number = 0;
     foreach (WorldObject obj in DepositedWorldObjects[type])
     {
         if (obj.Level == level)
             number++;
     }
     return number;
 }
Ejemplo n.º 28
0
        public bool ContainsWorldObject(MapElementType type, int level)
        {
            if (DepositedWorldObjects.ContainsKey(type) == false)
            {
                return false;
            }
            int number = 0;
            foreach (WorldObject obj in DepositedWorldObjects[type])
            {

                if (obj.Level == level)
                    number++;
            }
            if (number > 0)
                return true;
            return false;
        }
Ejemplo n.º 29
0
        public WorldObject GetDepositedWorldObject(MapElementType t, int level)
        {
            foreach (WorldObject obj in DepositedWorldObjects[t])
            {
                if (obj.Level == level)
                    return obj;
            }

            throw new Exception("World object not found");
        }
Ejemplo n.º 30
0
 public static WorldObject CreateWorldObject(MapElementType type, int level)
 {
     if (type == MapElementType.Plank)
         return new Plank(new Vector3Int(0, 0, 0), level);
     //else if (type == MapElementType.WoodBed)
     //    return new WoodBed(new Vector3Int(0, 0, 0), level);
     else if (type == MapElementType.WoodDoor)
         return new WoodDoor(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.WoodTable)
         return new WoodTable(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.WoodChair)
         return new WoodChair(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.SteamEngine)
         return new SteamEngine(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Rod)
         return new Rod(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Gear)
         return new Gear(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Rail)
         return new Rail(new Vector3Int(0, 0, 0), level);
     else if (type == MapElementType.IronBar)
         return new IronBar(new Vector3Int(0, 0, 0), level);
     else if (type == MapElementType.Fence)
         return new Fence(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Wheat)
         return new Wheat(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Beer)
         return new Beer(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.StoneBrick)
         return new StoneBrick(new Vector3Int(0, 0, 0), level);
     else if (type == MapElementType.IronTool)
         return new IronTool(new Vector3Int(0, 0, 0), level);
     else if (type == MapElementType.Meal)
         return new Meal(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Arrow)
         return new Arrow(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Bullet)
         return new Bullet(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.WhoolClowth)
         return new WhoolClowth(new Vector3Int(0, 0, 0), 1);
     else if (type == MapElementType.Cabbage)
         return new Cabbage(new Vector3Int(0, 0, 0));
     else if (type == MapElementType.Cannabis)
         return new Cannabis(new Vector3Int(0, 0, 0), 1);
     else if (type == MapElementType.WhiteMushroom)
         return new WhiteMushroom(new Vector3Int(0, 0, 0));
     else
         throw new Exception("Element not registred");
 }
Ejemplo n.º 31
0
 public Clowth(Vector3Int position, MapElementType type, int level)
     : base(position, type, level)
 {
 }
Ejemplo n.º 32
0
 public CraftingOfResourceTask(MapElementType type, int level)
 {
     Type = type;
     Level = level;
     TaskType = TaskType.CraftingOfResource;
 }
Ejemplo n.º 33
0
        public static int GetNumberOfCraftingTasksOfType(MapElementType type, bool includeInProgress)
        {
            int count = 0;

            if (_tasks.ContainsKey(TaskType.CraftingOfResource))
            {
                foreach (Task t in _tasks[TaskType.CraftingOfResource])
                {
                    CraftingOfResourceTask cof = (CraftingOfResourceTask)t;
                    if (cof.Type == type)
                        count++;
                }
            }
            if (includeInProgress)
            {
                if (_tasksInProgress.ContainsKey(TaskType.CraftingOfResource))
                {
                    foreach (Task t in _tasksInProgress[TaskType.CraftingOfResource])
                    {
                        CraftingOfResourceTask cof = (CraftingOfResourceTask)t;
                        if (cof.Type == type)
                            count++;
                    }
                }

            }
            return count;
        }
Ejemplo n.º 34
0
        /// <summary>
        /// Gets all the depos (including crafting buildings) that contains a world object of type e, level level
        /// </summary>
        /// <param name="e"></param>
        /// <param name="level"></param>
        /// <returns></returns>
        public List<Building> GetDepos(MapElementType e, int level)
        {
            List<Building> depos = GetBuildings(BuildingType.Depot);
            List<Building> deposContaining = new List<Building>();

            List<Building> otherBuildings = _buildings;

            foreach (Building b in depos)
            {
                if (b.IsBuildingConstructed() == false)
                    continue;

                Depot d = (Depot)b;
                if (d.ContainsWorldObject(e, level))
                    deposContaining.Add(d);
            }

            foreach (Building b in otherBuildings)
            {
                if (b.IsBuildingConstructed() == false)
                    continue;

                WorldObject obj = b.GetCraftSlot();
                if (b.IsCraftingItem() == false && obj != null && obj.ElementType == e && obj.Level == level)
                    deposContaining.Add(b);
            }

            return deposContaining;
        }
Ejemplo n.º 35
0
 private MapElementType ToggleElement()
 => currentElementType == MapElementType.Brick
     ? currentElementType = MapElementType.Concrete
     : currentElementType = MapElementType.Brick;
Ejemplo n.º 36
0
        public static void RemoveTasksOfType(MapElementType type)
        {
            List<Task> toRemove = new List<Task>();
            if (_tasks.ContainsKey(TaskType.CraftingOfResource))
            {
                foreach (Task t in _tasks[TaskType.CraftingOfResource])
                {
                    CraftingOfResourceTask cof = (CraftingOfResourceTask)t;
                    if (cof.Type == type)
                        toRemove.Add(t);
                }
            }

            foreach (Task t in toRemove)
            {
                _tasks[TaskType.CraftingOfResource].Remove(t);
            }
        }
Ejemplo n.º 37
0
 public void AddIngridience(MapElementType type)
 {
     Ingridients.Add(type);
 }
Ejemplo n.º 38
0
 public void TakeForCrafting(Dwarf d, MapElementType type)
 {
     _dwarfTaken = d;
     _typeBeingCrafted = type;
     _isCraftingItem = true;
 }
Ejemplo n.º 39
0
 // Any dwarf can start to craft anything
 public void ReleaseForCrafting()
 {
     _isCraftingItem = false;
     _dwarfTaken = null;
     _typeBeingCrafted = MapElementType.None;
 }
    private bool isTargetPositionForBoxPossible(Vector2Int pPosition)
    {
        MapElementType mapElementType = _levelController.GetElementAtIndex(pPosition.x, pPosition.y);

        return(mapElementType == MapElementType.GRASS || mapElementType == MapElementType.BOX_HOLDER);
    }
Ejemplo n.º 41
0
 public void RemoveDepositedWorldObject(MapElementType type, int level)
 {
     DepositedWorldObjects[type].Remove(GetDepositedWorldObject(type, level));
 }
 public bool Setup(MapElementType targetmapelementtype)
 {
     return(Setup(new List <MapElementType> {
         targetmapelementtype
     }));
 }
Ejemplo n.º 43
0
        public virtual WorldObject WithdrawWorldObject(MapElementType t, int level)
        {
            if (GetCraftSlot() != null && GetCraftSlot().ElementType == t && GetCraftSlot().Level == level)
            {
                return TakeCraftSlot();
            }

            if (DepositedWorldObjects.ContainsKey(t) == false || GetNumberOfDepositedMaterial(t, level) == 0)
                return null;
            else
            {
                WorldObject m = GetDepositedWorldObject(t, level);
                DepositedWorldObjects[t].Remove(m);
                return m;
            }
        }
Ejemplo n.º 44
0
        public override WorldObject WithdrawWorldObject(MapElementType t, int level)
        {
            if (t == MapElementType.Beer)
            {

            }
            //PrintDepositedWorldObjects();
            return base.WithdrawWorldObject(t, level);
        }
Ejemplo n.º 45
0
 public MapElement(MapElementType mapElementType) : this(0, 0, 0, mapElementType)
 {
 }
Ejemplo n.º 46
0
 public List<Building> GetCraftingBuildings(MapElementType t)
 {
     return GetBuildings(CraftRules.WorkshopNeededToCraft(t));
 }