Last active
April 12, 2018 17:17
-
-
Save ohiofi/d4fbd27bdb90178c0ca11ecb749278ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int GetWallDirection(){ | |
bool isWallLeft = Physics2D.Raycast (new Vector2 (transform.position.x - width, transform.position.y), -Vector2.right, rayCastLengthCheck); | |
bool isWallRight = Physics2D.Raycast (new Vector2 (transform.position.x + width, transform.position.y), Vector2.right, rayCastLengthCheck); | |
if (isWallLeft) | |
return -1; | |
else if(isWallRight) | |
return 1; | |
else | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment