Esempio n. 1
0
        private void FixedUpdate()
        {
            frameForce = Vector3.zero;

            if (resetPosition)
            {
                transform.position = startingPosition;
                resetPosition      = false;
            }

            if (!isHeld)
            {
                Vector3 orbitForce = orbitalMover.GetOrbitForce((int)Mathf.Sign(launchAngle));
                frameForce += orbitForce;

                if (launchPower > 0)
                {
                    Vector3 launchForce = launchDirection * launchPower * Time.fixedDeltaTime;
                    frameForce  += launchForce;
                    launchPower -= 0.01f * Time.timeScale;
                }
                else
                {
                    ResetLaunch();
                }
            }

            if (!float.IsNaN(frameForce.x) && !float.IsNaN(frameForce.y) && frameForce != Vector3.zero)
            {
                transform.position += frameForce;
            }
        }
Esempio n. 2
0
        private void FixedUpdate()
        {
            frameForce = Vector3.zero;

            if (!isHeld)
            {
                Vector3 orbitForce = orbitalMover.GetOrbitForce((int)Mathf.Sign(launchAngle));
                frameForce += orbitForce;
            }

            if (!float.IsNaN(frameForce.x) && !float.IsNaN(frameForce.y) && frameForce != Vector3.zero)
            {
                transform.position += frameForce;
            }
        }