コード例 #1
0
ファイル: Laser.cs プロジェクト: CAPZ-PEnuts/PEnuts_game
    private void OnTriggerStay(Collider other)
    {
        if (signal != null && !_state)
        {
            SignalHandeler signalHandeler = signalHandelerObject.GetComponent <SignalHandeler>();
            if (signalHandeler != null)
            {
                _state = true;
                if (!signalHandeler.Exists(signal))
                {
                    signalHandeler.AddSignal(signal, true);
                }
                else
                {
                    signalHandeler.SetSignal(signal, true);
                }

                laser1.SetActive(false);
                laser2.SetActive(false);
                laser3.SetActive(false);
                laser4.SetActive(false);
                laser5.SetActive(false);
                laser6.SetActive(false);
                FindObjectOfType <AudioManager>().Play("lazer");
            }
        }
    }
コード例 #2
0
 // Update is called once per frame
 void Update()
 {
     if (signal1 != null && signal2 != null && signalOut != null && signalHandelerObject != null)
     {
         SignalHandeler signalHandeler = signalHandelerObject.GetComponent <SignalHandeler>();
         if (signalHandeler != null)
         {
             if (status != (signalHandeler.GetSignal(signal1) && signalHandeler.GetSignal(signal2)))
             {
                 status = !status;
                 if (!signalHandeler.Exists(signalOut))
                 {
                     signalHandeler.AddSignal(signalOut, status);
                 }
                 else
                 {
                     signalHandeler.SetSignal(signalOut, status);
                 }
             }
         }
     }
 }
コード例 #3
0
    // Update is called once per frame
    void Update()
    {
        if (_state != _counter > 0)
        {
            if (_counter > 0)
            {
                FindObjectOfType <AudioManager>().Play("signalclique");
            }

            _state = !_state;
            if (signal != null)
            {
                SignalHandeler signalHandeler = signalHandelerObject.GetComponent <SignalHandeler>();
                if (signalHandeler != null)
                {
                    if (!signalHandeler.Exists(signal))
                    {
                        signalHandeler.AddSignal(signal, _state);
                    }
                    else
                    {
                        signalHandeler.SetSignal(signal, _state);
                    }
                }
            }
        }

        if (_counter > 0)
        {
            _counter--;
        }

        if (!_colorUpdated)
        {
            _colorUpdated = true;
            gameObject.GetComponent <Renderer>().material.color = signalHandelerObject.GetComponent <SignalHandeler>().GetSignalColor(signal);
        }
    }