Esempio n. 1
0
    public static BlockResource Create(BlockEntity2 blockEntity)
    {
        if (guidePaths == null)
        {
            guidePaths = new HashSet<string>();
            guidePaths.Add("BlockGuide");

            var blockTable = TableLoader.GetTable<BlockEntity2>();
            var vfxTable = TableLoader.GetTable<VFXEntity>();
            foreach (var entity in blockTable.Values)
            {
                VFXEntity res = vfxTable.Get(entity.chargeVFX1);
                if (res != null)
                {
                    if (!guidePaths.Contains(res.resource))
                    {
                        guidePaths.Add(res.resource);
                    }
                }
            }
        }

        BlockResource blockResource = new GameObject(blockEntity.blockType.ToString()).AddComponent<BlockResource>();
        blockResource.blockEntity = blockEntity;

        GameObject tileObj = CreateGameObject(blockEntity);
        tileObj.transform.parent = blockResource.transform;
        tileObj.transform.localPosition = Vector3.zero;

        return blockResource;
    }
Esempio n. 2
0
 private Block(BlockEntity2 entity, int x, int y)
     : base(1, 1, WorldAnchor.MiddleCenter)
 {
     this.entity = entity;
     this.x = x;
     this.y = y;
 }
Esempio n. 3
0
 public BlockCommand(BlockEntity2 blockEntity, int count, bool isCharged, int matchGeneration)
     : base(TableLoader.GetTable<CommandEntity>().Get(blockEntity.commandCode))
 {
     this.blockEntity = blockEntity;
     this.count = count;
     this.isChargedAttack = isCharged && blockEntity.maxChargeCount > 0;
     this.matchGeneration = matchGeneration;
 }
Esempio n. 4
0
 public Matching(PuzzlePanel panel, Pattern pattern, int x, int y, BlockEntity2 blockEntity, Block[] blocks)
 {
     this.panel = panel;
     this.pattern = pattern;
     this.x = x;
     this.y = y;
     this.blockEntity = blockEntity;
     this.blocks = blocks;
     remainChargeTime = ChargeTime;
 }
Esempio n. 5
0
    static GameObject CreateGameObject(BlockEntity2 blockEntity)
    {
        if (!string.IsNullOrEmpty(blockEntity.resource))
        {
            CubeTile tile = RecycleManager.Instance.Instantiate(blockEntity.resource).GetComponent<CubeTile>();
            tile.Pivot = CubeTile.E_Pivot.MC;
            return tile.gameObject;
        }

        Debug.LogError(string.Format("File not exists: {0}", blockEntity.resource));
        return null;
    }