public ItemData ItemFactory(itemEnum item) { ItemData data = new ItemData(); data.itemType = item; switch (item) { case itemEnum.ScaleUp: data.timer = 10; data.isTimeDependent = true; break; case itemEnum.ScaleDown: data.timer = 10; data.isTimeDependent = true; break; } return(data); }
public void SetItemType(itemEnum itemType) { SpriteRenderer renderer = gameObject.GetComponent <SpriteRenderer>(); this.itemType = itemType; switch (itemType) { case itemEnum.ScaleUp: renderer.color = Color.yellow; break; case itemEnum.ScaleDown: break; case itemEnum.MultiBall: renderer.color = Color.blue; break; default: break; } }
public void SetItem(itemEnum item) { //Item alınabilir mi? listItem.Add(ItemFactory(item)); GameManager.Instance.AddScore(); GameManager.Instance.Score(); switch (item) { case itemEnum.ScaleUp: gameObject.transform.localScale = scaleUpScale; break; case itemEnum.ScaleDown: gameObject.transform.localScale = scaleDownScale; break; case itemEnum.MultiBall: if (GameManager.Instance.BallList.Count == 1) { for (int i = 1; i < 3; i++) { GameObject clone = Instantiate(newBall); control = clone.GetComponent <BallControl>(); control.transform.position = new Vector2(GameManager.Instance.mainBall.transform.position.x, GameManager.Instance.mainBall.transform.position.y); control.velocity = Quaternion.AngleAxis(i * 30, Vector3.forward) * GameManager.Instance.mainBall.velocity; control.playerGameObject = this.gameObject; } } break; default: break; } }