Ejemplo n.º 1
0
        //***********************************************************************


        public override void Update()
        {
            if (useLimit)
            {
                float x = Mathf.Clamp(thisT.position.x, minPosX, maxPosX);
                float z = Mathf.Clamp(thisT.position.z, minPosZ, maxPosZ);
                thisT.position = new Vector3(x, thisT.position.y, z);
            }

            if (!GameControl.IsGamePlaying())
            {
                return;
            }
            if (destroyed || IsStunned() || IsDashing())
            {
                return;
            }

            base.Update();

            if (movementMode == _MovementMode.FreeForm)
            {
                float brakeBoost = Input.GetKey(KeyCode.Space) ? 2 : 1;
                thisT.Translate(velocity * moveSpeed * Time.deltaTime * GetTotalSpeedMultiplier(), Space.World);
                velocity *= (1 - Time.deltaTime * decceleration * velocity.magnitude * brakeBoost);
            }
        }