/// <summary> /// Start is called on the frame when a script is enabled just before /// any of the Update methods is called the first time. /// </summary> void Start() { if (this == player) { playerTransform = player.transform; hpManager = player.GetComponentInChildren <PlayerHealthManager>(); physics = player.GetComponentInChildren <PlayerPhysics>(); movementModifier = player.GetComponentInChildren <PlayerMovementModifier>(); clipManager = player.GetComponentInChildren <PlayerClipManager>(); graphicsManager = player.GetComponentInChildren <PlayerGraphicsManager>(); playerController = player.GetComponentInChildren <PlayerControllerScript>(); playerAudio = player.GetComponentInChildren <PlayerAudioSource>(); } }
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; }