-
-
Save seferciogluecce/051fcf98e33e6910fd7e595eee233b2c 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
Vector2 initPos; | |
Vector2 MinPos; | |
Vector2 MaxPos; | |
Vector2 targetPos; | |
public float Speed = 2; | |
public float thresholdStopDistance = .3f; | |
void Start() | |
{ | |
initPos = transform.position; | |
targetPos = initPos; | |
Vector2 Size = GetComponent<SpriteRenderer>().bounds.extents; | |
MinPos = (Vector2)Camera.main.ViewportToWorldPoint(new Vector2(0, 0)) + Size; | |
MaxPos = (Vector2)Camera.main.ViewportToWorldPoint(new Vector2(1, 1)) - Size; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment