コード例 #1
0
ファイル: Brick.cs プロジェクト: langtuandroid/BlockPuzzle
 public void SpawnStaticBrick(List <Vector2> positions)
 {
     brickType = 8;
     foreach (Vector2 vt in positions)
     {
         BrickPart part = (BrickPart)Instantiate(partPrefab);
         part.transform.SetParent(partRegion);
         part.transform.localScale = Vector3.one;
         part.image.sprite         = sprites[brickType];
         part.image.color          = Color.gray;
         part.frame.SetActive(false);
         part.GetComponent <RectTransform>().anchoredPosition = new Vector3(vt.x * BRICK_SIZE, vt.y * BRICK_SIZE);
         part.pos = vt;
         parts.Add(part);
     }
     UpdateCorner();
 }
コード例 #2
0
ファイル: Brick.cs プロジェクト: langtuandroid/BlockPuzzle
 public void SpawnBrick(int type, bool shadow = false)
 {
     brickType = type;
     isShadow  = shadow;
     foreach (Vector2 vt in BRICK_POS[type])
     {
         BrickPart part = (BrickPart)Instantiate(partPrefab);
         part.transform.SetParent(partRegion);
         part.transform.localScale = Vector3.one;
         part.image.sprite         = isShadow ? sprites[7] : sprites[type];
         part.image.SetColorAlpha(isShadow ? 0.2f : 1);
         part.frame.SetActive(!isShadow);
         part.GetComponent <RectTransform>().anchoredPosition = new Vector3(vt.x * BRICK_SIZE, vt.y * BRICK_SIZE);
         part.pos = vt;
         parts.Add(part);
     }
     UpdateCorner();
 }