private void ShowResult() { this.pattern.SetActive(false); Flower[] flowers = this.kago.GetComponentsInChildren <Flower>(); for (int i = 0; i < flowers.Length; i++) { Flower flower = flowers[i]; flower.DefaultShader(); flower.SeasonColor(); } BoidsConfig config = this.GetComponent <BoidsConfig>(); GameObject container = config.GetBoidsContainer(); Leaf[] leafs = container.GetComponentsInChildren <Leaf>(); for (int i = 0; i < leafs.Length; i++) { GameObject.Destroy(leafs[i].gameObject); } GameObject.Destroy(this.player.gameObject); this.kagoCover.SetActive(false); this.transition.frames = 120; this.transition.transitionIn = false; this.transition.animate = true; }
public void OnSeasonChanged(GameController.Seasons season) { BoidsConfig config = this.GetComponent <BoidsConfig>(); GameObject container = config.GetBoidsContainer(); Leaf[] leafs = container.GetComponentsInChildren <Leaf>(); for (int i = 0; i < leafs.Length; i++) { leafs[i].SetSeason(season); } this.player.SetSeason(season); }
private void Finish() { BoidsConfig config = this.GetComponent <BoidsConfig>(); GameObject container = config.GetBoidsContainer(); Leaf[] leafs = container.GetComponentsInChildren <Leaf>(); for (int i = 0; i < leafs.Length; i++) { leafs[i].Idle(); } this.player.Idle(); this.transition.frames = 120; this.transition.transitionIn = true; this.transition.animate = true; }
void AddLeaf() { if (this.enabledLeafs >= this.maxLeafs) { return; } Vector3 maxScreenPos = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, 0)); Vector3 pos = new Vector3( Random.Range(-maxScreenPos.x, maxScreenPos.x), Random.Range(-maxScreenPos.y, maxScreenPos.y), 0.0f ); GameObject boid = Instantiate <GameObject>(this.boidPrefab, pos, Quaternion.identity); boid.transform.rotation = Quaternion.Euler(0.0f, 0.0f, Random.Range(0.0f, 360.0f)); float scale = Random.Range(0.2f, 0.3f); boid.transform.localScale = new Vector3(scale, scale, scale); BoidsConfig config = this.GetComponent <BoidsConfig>(); GameObject container = config.GetBoidsContainer(); boid.transform.parent = container.transform; BoidsEntity entity = boid.GetComponent <BoidsEntity>(); entity.config = config; Leaf leaf = boid.GetComponent <Leaf>(); leaf.gameController = this; leaf.SetSeason(this.GetCurrentSeason()); this.enabledLeafs++; }