public override void OnStart() { base.OnStart(); rainBow = this.GetComponentInChildren <RainBow>(); rainBow.AddEventListener(this.gameObject); rainBow.StartAnimation(); }
private void resetCart() { this.transform.position = new Vector3(this.transform.position.x, this.transform.position.y, startPos); cartStage = CART_STAGES.entry; pebleCount = 0; setRandomColor(); RainBow.currentColor = pebleColor; setPropColors(); disableProps(); setHealth(3); health = 3; correctCount = 0; counter.text = "0/20"; pebleImage.color = RainBow.getColor(pebleColor); }
//-------------Form 呼叫的 Paint-------------// public void Paint(Graphics g) { Background.Paint(g); //------ 遊戲開始 if (step == 1) { RainBow.Paint(g); if (WingL != null) { WingL.Paint(g); } if (WingR != null) { WingR.Paint(g); } Cloud.Paint(g); mainCharactor.Paint(g); stone.Paint(g); yellowBird.Paint(g); } //------ 換頁效果 if (step == 5 || step == 2 || step == 3) { turn.Paint(g); } //------ 說明頁 if (explain != null && ExplainPlayBtn != null) { explain.Paint(g); ExplainPlayBtn.Paint(g); if (Global.Mode != 0) { rNextBtn.Paint(g); lNextBtn.Paint(g); } if (explainPage == 1) { WingL.Paint(g); WingR.Paint(g); } } }
private void OnTriggerEnter(Collider other) { if (cartStage.Equals(CART_STAGES.gameplay)) { if (other.tag == "Peble") { Destroy(other.gameObject); pebleProps[pebleCount].gameObject.SetActive(true); pebleProps[pebleCount].GetComponent <Renderer>().material.color = other.GetComponent <Renderer>().material.color; pebleCount++; if (other.GetComponent <Renderer>().material.color != RainBow.getColor(pebleColor)) { health--; setHealth(health); audioSource.PlayOneShot(wrongSound); if (health <= 0) { cartStage = CART_STAGES.leave; endGame = true; } } else { correctCount++; counter.text = correctCount.ToString() + "/20"; if (pebleCount > pebleProps.Length - 1) { pebleCount = 0; cartStage = CART_STAGES.leave; audioSource.PlayOneShot(winSound); } else { audioSource.PlayOneShot(collectSound); } } } } }
public void setPropColors() { staticPebleMat.color = RainBow.getColor(pebleColor); }