void Start() { PlayerBox = GetComponentInParent <BoxCollider2D>(); PlayerRect = new Rectangle(PlayerBox, 0); XW = PlayerRect.B.x; YW = PlayerRect.B.y; PlayerRect.Reset(PlayerBox, skinWidth); XW -= PlayerRect.B.x; YW -= PlayerRect.B.y; HorizontalRayCount = Mathf.Clamp(HorizontalRayCount, 2, int.MaxValue); VerticalRayCount = Mathf.Clamp(VerticalRayCount, 2, int.MaxValue); // paused = false; playerTransform = PlayerInstanciationScript.playerTransform; playerPhysics = PlayerInstanciationScript.player.GetComponentInChildren <PlayerPhysics>(); }
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; }