public void SetPresentType(PresentInfo.Type type) { switch (type) { case PresentInfo.Type.NONE: currentPresentType = PresentInfo.Type.NONE; ImageColor.sprite = null; ImageColor.color = Color.gray; break; case PresentInfo.Type.RED: currentPresentType = PresentInfo.Type.RED; ImageColor.color = new Color(1, 1, 1, 1); ImageColor.sprite = PresentImageSprites[0]; break; case PresentInfo.Type.BLUE: currentPresentType = PresentInfo.Type.BLUE; ImageColor.color = new Color(1, 1, 1, 1); ImageColor.sprite = PresentImageSprites[1]; break; case PresentInfo.Type.YELLOW: currentPresentType = PresentInfo.Type.YELLOW; ImageColor.color = new Color(1, 1, 1, 1); ImageColor.sprite = PresentImageSprites[2]; break; } }
public void SetHavePresent(PresentInfo.Type type) { for (int i = 0; i < GameInfo.MAX_HAVEPRESENT; i++) { //所持できるプレゼントに空きがあったら if (HavePresent[i].GetPresentType() == PresentInfo.Type.NONE) { HavePresent[i].SetPresentType(type); return; } } }
/* * void OnTriggerEnter2D(Collider2D col){ * * if(col.gameObject.tag == "Player"){ * this.gameObject.SetActive(false); * //StartCoroutine ("PresentMoveAnimation"); * } * * } */ void InitializeType() { switch (this.gameObject.tag) { case "P_red": currentPresentType = PresentInfo.Type.RED; break; case "P_yellow": currentPresentType = PresentInfo.Type.YELLOW; break; case "P_blue": currentPresentType = PresentInfo.Type.BLUE; break; } }
// 欲しい人にプレゼントを持って行ったときに欲しい色があるかどうか見つける処理 public void FindHavePresent(PresentInfo.Type type) { for (int i = 0; i < GameInfo.MAX_HAVEPRESENT; i++) { //もしもみつけたら if (HavePresent[i].GetPresentType() == type) { HavePresent[i].SetPresentType(PresentInfo.Type.NONE); //スコアをプラスする ScoreManager.instance.score += 100; ScoreManager.instance.GetPresent += 1; //音をつける AudioManager.Instance.PlaySE("SuccessPresent"); return; } } //みつかんなかったらなにもしない //音をつける AudioManager.Instance.PlaySE("FailPresent"); }