コード例 #1
0
    // Start is called before the first frame update
    void Start()
    {
        _TileMap = WorldController.GetWorldController.TileMap;
        Lib      = WorldController.GetWorldController.GetComponentInChildren <TileLibrary>();
        MSC      = WorldController.GetWorldController.GetComponentInChildren <MapSaveController>();
        Dictionary <int, GameObject> t = Lib.GetTileList();

        TileIds = new List <int>(t.Keys);
        TileIds.Sort();
    }
コード例 #2
0
    // Start is called before the first frame update
    void Start()
    {
        _Lib = GetComponent <TileLibrary>();

        Dictionary <int, GameObject> t = _Lib.GetTileList();

        TileIds = new List <int>(t.Keys);
        TileIds.Sort();
        _worldController = WorldController.GetWorldController;
    }
コード例 #3
0
    /// <summary>
    /// Change the rock model to drop ore or energy crystals depending on the current rocks drop type
    /// </summary>
    public void ChangeRockDropType()
    {
        Tile selectedTile = LevelEditor.CurrentSelectedTile;
        int  rockTypeId   = selectedTile.GetComponent <RockScript>().GetID();

        if (_rockCrystalToggle.isOn != (rockTypeId == (int)Tile.TileTypeID.DirtEnergy || rockTypeId == (int)Tile.TileTypeID.HardRockEnergy || rockTypeId == (int)Tile.TileTypeID.LooseRockEnergy))
        {
            Dictionary <int, GameObject> tileDic = TileLib.GetTileList();
            GameObject newRockPrefab             = tileDic[rockTypeId];

            switch (rockTypeId)
            {
            case (int)Tile.TileTypeID.Dirt:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.DirtEnergy];
                break;

            case (int)Tile.TileTypeID.DirtEnergy:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.Dirt];
                break;

            case (int)Tile.TileTypeID.LooseRock:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.LooseRockEnergy];
                break;

            case (int)Tile.TileTypeID.LooseRockEnergy:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.LooseRock];
                break;

            case (int)Tile.TileTypeID.HardRock:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.HardRockEnergy];
                break;

            case (int)Tile.TileTypeID.HardRockEnergy:
                newRockPrefab = tileDic[(int)Tile.TileTypeID.HardRock];
                break;
            }

            TileMap.UpdateTile(selectedTile.X, selectedTile.Y, newRockPrefab);
            LevelEditor.CurrentSelectedTile = TileMap.GetTileAtPos(selectedTile.X, selectedTile.Y);
        }
    }