void ChangeSignal() { if (who.gameObject.activeInHierarchy) { //Debug.Log("人が領域に入ってる"); if (Input.GetKey(KeyCode.K)) { if (seconds >= 0.25) { SignalBox.changeFlag(); if (SignalBox.getFlag()) { havescript2.GetComponent <GreenAn>().AnotherColorChange2P(); //緑オン havescript1.GetComponent <RedAn>().AnotherNoColorChange(); //赤オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } else if (!SignalBox.getFlag()) { havescript1.GetComponent <RedAn>().AnotherColorChange(); //赤オン havescript2.GetComponent <GreenAn>().AnotherNoColorChange2P(); //緑オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } } } } }
void ChangeSignal() { if (who.gameObject.activeInHierarchy) { Debug.Log("人が領域に入ってる"); if (Input.GetKey(KeyCode.K)) { if (seconds >= 0.25) { SignalBox.changeFlag(); SignalBox2.changeFlag(); if (SignalBox.getFlag()) { child.GetComponent <Green>().ColorChange2P(); //緑オン child2.GetComponent <Red>().NoColorChange(); //赤オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } else if (!SignalBox.getFlag()) { child2.GetComponent <Red>().ColorChange(); //赤オン child.GetComponent <Green>().NoColorChange2P(); //緑オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } if (SignalBox2.getFlag()) { child.GetComponent <Green>().ColorChange2P(); //緑オン child2.GetComponent <Red>().NoColorChange(); //赤オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } else if (!SignalBox2.getFlag()) { child2.GetComponent <Red>().ColorChange(); //赤オン child.GetComponent <Green>().NoColorChange2P(); //緑オフ SE.instance.PlaySE(BGM_Gim); seconds = 0; } } } } }