示例#1
0
            void Start()
            {
                sensor           = GetComponentInChildren <CollisionSensorScript>();
                playerPhysics    = GetComponent <PlayerPhysics>();
                playerController = PlayerInstanciationScript.playerController;
                graphicsManager  = PlayerInstanciationScript.graphicsManager;
                groundVector     = Vector2.right;
                playerPhysics.SetGravity((8 * jumpHeight) / (jumpTime * jumpTime));
                maxAirborneSpeed  = maxJumpWidth / jumpTime;
                jumpSpeedY0       = (4 * jumpHeight) / jumpTime;
                climbSpeed        = Mathf.Sqrt(2 * playerPhysics.GetGravity() * jumpHeightFromWall);
                doubleJumpSpeedY0 = Mathf.Sqrt(2 * playerPhysics.GetGravity() * doubleJumpHeight);

                paused = false;
            }
示例#2
0
 /// <summary>
 /// triggers a jump that reaches y + pinnacle
 /// </summary>
 /// <param name="pinnacle">the altitude to reach</param>
 public void TrampolineJump(float pinnacle)
 {
     jumpSpeedY0       = Mathf.Sqrt(2 * pinnacle * playerPhysics.GetGravity());
     trampolineTrigger = true;
 }