void Start() { BGSea = GameObject.FindWithTag("BG").gameObject; islandstage = new SpriteRenderer[7] { BGSea.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(1).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(2).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(3).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(4).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(5).GetComponent <SpriteRenderer>(), BGSea.transform.GetChild(0).GetChild(6).GetComponent <SpriteRenderer>() }; if (GameObject.FindGameObjectWithTag("AllScene")) { allScene = GameObject.FindGameObjectWithTag("AllScene").transform.GetComponent <SceneManagerScript>(); ClearStageNum = allScene.GetClearData(); ClearStageCheck(); CheckFind_SceneManager = true; } if (!CheckFind_SceneManager) { Debug.Log("シーンマネージャーがないよ!"); } if (Cloudmat) { Cloudmat.EnableKeyword("cloudClear"); Cloudmat.SetFloat("_cloudClear", 0); } if (Seamat) { Seamat.EnableKeyword("WaveHeight"); Seamat.SetFloat("_WaveHeight", WaveHeight); } }
//=================================================== // 全ステージクリア直後処理 //=================================================== IEnumerator AllStageClear() { for (int i = 0; i < rainbows.Length; i++) { rainbows[i].gameObject.SetActive(true); } Light directlight = GameObject.FindGameObjectWithTag("Light").transform.GetComponent <Light>(); Camera cam = Camera.main.gameObject.GetComponent <Camera>(); var nowcolor = directlight.color; var lightpos = directlight.transform.position; RainParticle = BGSea.transform.GetChild(1).GetComponent <ParticleSystem>(); var emission = RainParticle.emission; Cloudmat.EnableKeyword("_cloudClear"); Seamat.EnableKeyword("WaveHeight"); yield return(new WaitForSeconds(5f)); var val = 0f; while (val <= ClearAnimationTime) { val += Time.deltaTime; var count = val / ClearAnimationTime; if (count < 1) { directlight.transform.position = Vector3.Lerp(lightpos, new Vector3(0, 50, -10), count); directlight.color = Color.Lerp(nowcolor, Color.white, count); cam.backgroundColor = directlight.color; emission.rateOverTime = 300 - 300 * ((val + 1.5f) / ClearAnimationTime); Cloudmat.SetFloat("_cloudClear", count); Seamat.SetFloat("_WaveHeight", WaveHeight + 0.1f - WaveHeight * count); for (int i = 0; i < rainbows.Length; i++) { rainbows[i].transform.localScale = new Vector3(rainbows[i].transform.localScale.x, Mathf.Lerp(rainbows[i].transform.localScale.y, 0.5f, count), rainbows[i].transform.localScale.z); } } yield return(new WaitForEndOfFrame()); } if (allScene) { allScene.Loadstagenum(100); } }