Exemple #1
0
        public void SetCursorBlock(MapBlock block)
        {
            if (blockController != null)
            {
                Destroy(blockController.gameObject);
            }

            blockController = MapManager.Instance.InstantiateSceneBlock(block);
            if (blockController != null)
            {
                blockController.transform.position = transform.position;
                blockController.transform.parent   = transform;
                SetLayerRecursive(blockController.transform, 2); // ignore raycast
            }
        }
Exemple #2
0
        public MapBlockController InstantiateSceneBlock(MapBlock mapBlock)
        {
            MapBlockController blockController = null;

            if (mapBlock == null)
            {
                return(null);
            }

            var prefab = FindBlockPrefabWithType(mapBlock.Type);

            if (prefab == null)
            {
                return(null);
            }

            blockController       = Instantiate(prefab).GetComponent <MapBlockController>();
            blockController.Block = mapBlock;
            blockController.UpdateBlockState();
            return(blockController);
        }