示例#1
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;
    }
示例#2
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();
    }
示例#3
0
 void SetupBuildingIcon(UnitTask Task)
 {
     if (Task._targetBuilding == null)
     {
         SetIcon(ConvertTaskToOrderType(Task._taskType));
         return;
     }
     CurrnetType = OrderVisualType.Build;
     _decal.Mat.SetTexture("_BaseColorMap", TileLibrary.Get().GetBuildingTexture((Tile.TileTypeID)Task._targetBuilding.GetID()));
     _decal.enabled = (CurrnetType != OrderVisualType.None);
 }
示例#4
0
 private void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
示例#5
0
 void Start()
 {
     TileMap    = WorldController.GetWorldController.TileMap;
     TileLib    = WorldController.GetWorldController.GetComponentInChildren <TileLibrary>();
     MapSaver   = WorldController.GetWorldController.GetComponentInChildren <MapSaveController>();
     MenuScript = GetComponent <MenuScript>();
     if (StaticMapInfo.Level != "" && StaticMapInfo.LoadingIntoLevelEditor)
     {
         HideAllDialogPanels();
         _yourMapsPanel.SetActive(false);
         //  MapSaver.LoadTileSet(StaticMapInfo.Level);
     }
 }
    private void Awake()
    {
        if (!instance)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }

        Tiles = new Dictionary <string, IGameTile>();

        InitLibrary();
    }
示例#7
0
    void Awake()
    {
        if (I == null){
            I = this;
            DontDestroyOnLoad(gameObject);
        }else{
            GameObject.Destroy(gameObject);
        }

        foreach (var item in tilePrefabs) {
            tilePrefabsDict.Add(item.type, item.prefab);
        }

        keyColorDict.Add(KeyType.RED, Color.red);
        keyColorDict.Add(KeyType.GREEN, Color.green);
        keyColorDict.Add(KeyType.BLUE, Color.blue);
    }
    void BuildGridWithSavedData()
    {
        _TileMap.NotifyLoading(true);
        _TileMap.DestroyGrid();
        _TileMap.SetGridSize(FileData.GridXSize, FileData.GridYSize);
        _TileMap.BuildTiles();
        int Itor = 0;

        for (int x = 0; x < _TileMap.GridXSize_; x++)
        {
            for (int y = 0; y < _TileMap.GridYSize_; y++)
            {
                _TileMap.UpdateTile(x, y, GetTile(FileData.Data[Itor]), true);
                Tile t = _TileMap.GetTileAtPos(x, y);
                FileData.Data[Itor].ApplySeralToTile(t);
                if (t.IgnoreBuild)
                {
                    int    tId  = t.GetID();
                    string tTag = t.tag;
                    if (t.GetComponent <Building>())
                    {
                        Vector2[] temp = t.GetComponent <Building>()._BuildingSize;
                        if (temp.Length > 0)
                        {
                            for (int i = 0; i < temp.Length; i++)
                            {
                                Tile OtherT = _TileMap.GetTileAtPos(x + (int)temp[i].x, y + (int)temp[i].y);
                                _TileMap.UpdateTile(OtherT.X, OtherT.Y, TileLibrary.Get().GetTilePrefab(OtherT.GetOldID()));
                            }
                        }
                    }
                    _TileMap.ClearTile(x, y);
                    t = _TileMap.GetTileAtPos(x, y);
                    t.SetID(tId);
                    t.tag         = tTag;
                    t.IgnoreBuild = true;
                }
                t.TileStart();
                //UpdateBuilding(t);
                Itor++;
            }
        }
        _TileMap.BroadcastGridCreate();
        _TileMap.NotifyLoading(false);
    }
示例#9
0
 void SetIcon(OrderVisualType Type)
 {
     CurrnetType = Type;
     _decal.Mat.SetTexture("_BaseColorMap", TileLibrary.Get().GetOrderIcon(CurrnetType));
     _decal.enabled = (Type != OrderVisualType.None);
 }
    void Awake()
    {
        tileLib = GameObject.FindGameObjectWithTag("Library").GetComponent<TileLibrary>();
        camCtrl = GetComponent<CameraController>();

        act = MenuUpdate;

        mapLib = GameObject.FindGameObjectWithTag("Library").GetComponent<MapLibrary>();
    }
示例#11
0
 void Awake()
 {
     gameCtrl = GetComponent<GameController>();
     tileLib = GameObject.FindGameObjectWithTag("Library").GetComponent<TileLibrary>();
     mapLib = GameObject.FindGameObjectWithTag("Library").GetComponent<MapLibrary>();
 }