Пример #1
0
    void Update()
    {
        if (!isServer)
        {
            return;
        }

        if (UtilBehaviour.IsOutOfWorld(gameObject.transform.position) && !_destoyed)
        {
            _destoyed = true;
            CmdDestroy(true);
        }


        /// From initial asteroid position to game position
        if (_startAnimation && Mathf.Abs(transform.position.y) < UtilBehaviour.Y_GAME - IGNORE_LERP)
        {
            transform.position = Vector3.Lerp(transform.position,
                                              new Vector3(transform.position.x,
                                                          UtilBehaviour.Y_GAME,
                                                          transform.position.z),
                                              Time.deltaTime * START_ANIMATION_DURATION);
        }
        else
        {
            _startAnimation    = false;
            transform.position = new Vector3(gameObject.transform.position.x, UtilBehaviour.Y_GAME, gameObject.transform.position.z);
        }
    }
Пример #2
0
    void FixedUpdate()
    {
        if (!isLocalPlayer || _isDead)
        {
            return;
        }

        if (BoostButtonBehaviour.instance.pressed)
        {
            if (!_boosted)
            {
                _boost.Play();
                _boosted = true;

                _rb.AddForce(transform.forward * _BOOST_SPEED, ForceMode.Acceleration);
            }
            else
            {
                _rb.AddForce(transform.forward * _SPEED, ForceMode.Acceleration);
            }
        }
        else
        {
            _boosted = false;
        }

        if (UtilBehaviour.IsOutOfWorld(_rb.position))
        {
            _outOfCombatAreaObserver.OnNotify(true);
        }
        else
        {
            _outOfCombatAreaObserver.OnNotify(false);
        }
    }
    void Update()
    {
        if (!isServer)
        {
            return;
        }

        if ((UtilBehaviour.IsOutOfWorld(gameObject.transform.position) ||
             UtilBehaviour.IsOutOfY(gameObject.transform.position.y)) && !_destoyed)
        {
            _destoyed = true;
            CmdDestroy(true);
        }
    }