private void Start() { m_countToggle = 0.0f; m_countGoal = 0f; m_fermion = transform.GetComponentInChildren <Fermion>(); m_boson = transform.GetComponentInChildren <Boson>(); m_isToggling = false; m_isGoaling = false; m_canToggle = true; //最初はフェルミオンで始まる m_boson.trulyUsedMaxSpeed = m_fermion.trulyUsedMaxSpeed = m_fermion.uniqueMaxSpeed(); m_boson.gameObject.layer = LayerMask.NameToLayer("NotUsedActor"); }
private void correctBpos(ref Boson b) { if (!b.isUtilized) { return; } Camera c = Camera.main; Vector2 min = c.ViewportToWorldPoint(new Vector2(0f, 0f)); Vector2 max = c.ViewportToWorldPoint(new Vector2(1f, 1f)); Vector2 pos = b.transform.position; pos.x = Mathf.Clamp(pos.x, min.x, max.x); b.transform.position = pos; if (pos.y < min.y - 3f) { int stageNo = TransitionManager.Instance.stageNo; string s = "scene_stage0" + stageNo; TransitionManager.Instance.transite(s, 0.5f, 0.2f); } }
private void Update() { if (!m_fermion) { return; } Fermion fermion = m_fermion.GetComponent <Fermion>(); m_fermionHPgauge.GetComponent <Image>().fillAmount = (float)fermion.HP / (float)fermion.maxHP; Boson boson = m_boson.GetComponent <Boson>(); m_bosonHPgauge.GetComponent <Image>().fillAmount = (float)boson.HP / (float)boson.maxHP; if (fermion.childFermionNumber > 0) { m_childFermionUI.SetActive(true); m_textMesh.SetActive(true); string text = "X " + fermion.childFermionNumber; m_textMesh.GetComponent <TextMeshProUGUI>().text = text; } }
private IEnumerator salvation(float fadeOutTime, float fadeInTime) { float time = 0; isSalvated = true; while (true) { Color color = m_fadePlane.GetComponent <Image>().color; color.a = time / fadeOutTime; m_fadePlane.GetComponent <Image>().color = color; time += Time.deltaTime; if (color.a > 1f) { color.a = 1f; break; } yield return(null); } //問答無用 Fermion f = FindObjectOfType <Fermion>(); Boson b = FindObjectOfType <Boson>(); if (f != null) { f.transform.position = StageManager.Instance.startPos[stageNo]; // f.enabled = true; } if (b != null) { b.transform.position = StageManager.Instance.startPos[stageNo]; // b.enabled = true; } Color c = m_fadePlane.GetComponent <Image>().color; c.a = 0f; m_fadePlane.GetComponent <Image>().color = c; //だんだん明るく time = 0; while (true) { Color color = m_fadePlane.GetComponent <Image>().color; color.a = 1f - time / fadeInTime; m_fadePlane.GetComponent <Image>().color = color; time += Time.deltaTime; if (color.a < 0f) { color.a = 0f; break; } yield return(null); } isSalvated = false; }