public void Init(PrepareBall prepare) { this.Type = prepare.Type; this.Color = prepare.Color; if (Type == BallType.Normal) { spriteRenderer.sprite = spriteNormal[(int)this.Color]; } else if (Type == BallType.Ghost) { spriteRenderer.sprite = spriteGhost; } else if (Type == BallType.Rainbow) { spriteRenderer.sprite = spriteRainbow; } else if (Type == BallType.Bomb) { spriteRenderer.sprite = spriteBomb; } else if (Type == BallType.Stone) { spriteRenderer.sprite = spriteStone; } }
public void CreateBallAtBlock(PrepareBall prepare) { if (CurrentBall != null) { Debug.LogError("A Ball already occupied this " + gameObject.name); } Board.Inst.EmptyBlocks.Remove(this); CurrentBall = ballPrefab.Spawn(transform.position, Quaternion.identity, Vector3.one, this.transform).GetComponent <Ball>(); CurrentBall.Init(prepare); }