// Use this for initialization. void Start() { // Setting up references. rigidbody = GetComponent <Rigidbody2D>(); groundCheck = transform.Find("groundCheck"); frontCheckTop = new GameObject("frontCheckTop"); frontCheckBot = new GameObject("frontCheckBot"); playerJump = GetComponent <PlayerJump>(); playerWall = GetComponent <PlayerWall>(); playerRun = GetComponent <PlayerRun>(); playerCrouch = GetComponent <PlayerCrouch>(); playerDash = GetComponent <PlayerDash>(); playerHitbox = GetComponent <PlayerHitbox>(); playerPlatform = GetComponent <PlayerPlatform>(); normalRotation = transform.localRotation; animator = GetComponent <Animator>(); gravityScale = rigidbody.gravityScale; // Set the frontCheck and backCheck transform parent to the player's transform. frontCheckTop.transform.parent = transform; frontCheckBot.transform.parent = transform; // Check which direction the player is facing based on the spriteDirection and flip when the spriteDirection is Left. if (spriteDirection == Direction.Right) { facingRight = true; } else { facingRight = false; Flip(); } // Change the side marker positions. playerHitbox.ChangeSidePositions(); Debug.Log("vdd"); }
// Use this for initialization. void Start () { // Setting up references. rigidbody = GetComponent<Rigidbody2D>(); groundCheck = transform.Find("groundCheck"); frontCheckTop = new GameObject("frontCheckTop"); frontCheckBot = new GameObject("frontCheckBot"); playerJump = GetComponent<PlayerJump>(); playerWall = GetComponent<PlayerWall>(); playerRun = GetComponent<PlayerRun>(); playerCrouch = GetComponent<PlayerCrouch>(); playerDash = GetComponent<PlayerDash>(); playerHitbox = GetComponent<PlayerHitbox>(); playerPlatform = GetComponent<PlayerPlatform>(); normalRotation = transform.localRotation; animator = GetComponent<Animator>(); gravityScale = rigidbody.gravityScale; // Set the frontCheck and backCheck transform parent to the player's transform. frontCheckTop.transform.parent = transform; frontCheckBot.transform.parent = transform; // Check which direction the player is facing based on the spriteDirection and flip when the spriteDirection is Left. if (spriteDirection == Direction.Right) { facingRight = true; } else { facingRight = false; Flip(); } // Change the side marker positions. playerHitbox.ChangeSidePositions(); }