コード例 #1
0
 private void Update()
 {
     if (!mFreeze)
     {
         transform.position += mCurrentDirection * mCurrentSpeed * Time.deltaTime;
         if (_CurrentDistance < mTriggerDistance)
         {
             WifiPoint intermediary = mWifiPointTarget;
             mWifiPointTarget  = mWifiPointTarget.GetRandomNextWifiPoint(mOriginPoint);
             mOriginPoint      = intermediary;
             mCurrentDirection = (mWifiPointTarget.transform.position - mOriginPoint.transform.position).normalized;
         }
     }
 }
コード例 #2
0
    private void Awake()
    {
        sInstance = this;
        GameManager.OnGameReady += delegate {
            mFreeze            = false;
            transform.position = WifiManager.sClosestWifiPoint.transform.position;
            mOriginPoint       = WifiManager.sClosestWifiPoint;
            mWifiPointTarget   = mOriginPoint.GetRandomNextWifiPoint(mOriginPoint);
            mCurrentDirection  = (mWifiPointTarget.transform.position - mOriginPoint.transform.position).normalized;
            SwitchSpeed();
        };
        SignalScanner.OnBigDisconnection += delegate
        {
            mFreeze       = true;
            mCurrentSpeed = 0;
            CancelInvoke(nameof(SwitchSpeed));

            Shader.SetGlobalVector("SignalInfo", new Vector4(transform.position.x, transform.position.z, SignalScanner.sDistanceToBigReconnect, 1));
            if (mIndicatorVFX != null)
            {
                mIndicatorVFX.transform.position = transform.position;
                mIndicatorVFX.Play();
            }
        };
        SignalScanner.OnBigReconnection += delegate
        {
            mFreeze = false;
            SwitchSpeed();

            Shader.SetGlobalVector("SignalInfo", Vector4.zero);
            if (mIndicatorVFX != null)
            {
                mIndicatorVFX.Stop(true, ParticleSystemStopBehavior.StopEmitting);
            }
        };
    }