Ejemplo n.º 1
0
    public void PlaceUnit(Vector2Int p, UnitType unitType)
    {
        if (units.ContainsKey(p))
        {
            DeleteUnitAt(p);
        }

        Unit unit = BoardHelper.CreateUnit(transform, null, p, unitType);

        units.Add(unit.Position, unit);
    }
Ejemplo n.º 2
0
    public void PlaceUnit(Vector2Int p, UnitType unitType)
    {
        if (units.ContainsKey(p))
        {
            BoardHelper.DeleteUnitAt(p, ref units);
        }

        Unit unit = BoardHelper.CreateUnit(
            Container.transform,
            this,
            p,
            unitType);

        units.Add(unit.Position, unit);
    }
Ejemplo n.º 3
0
    public void Load()
    {
        if (Container.LevelData == null)
        {
            Container.LevelData = GameManager.Instance.SetCurrentLevel();
        }

        foreach (TileSpawnData data in Container.LevelData.tiles)
        {
            PlaceTile(data.location, data.tileType);
        }

        foreach (UnitSpawnData data in Container.LevelData.units)
        {
            Unit unit = BoardHelper.CreateUnit(
                Container.transform, this,
                data.location, data.unitType);

            units.Add(unit.Position, unit);
        }
    }