๊ฐ„๋‹จํ•œ ํ๊ฒŒ์ž„ ๋งŒ๋“ค์–ด๋ณด๋Š”์ค‘์ด๊ณ 



์•„๋ž˜๋Š” Ball ์˜ ์Šคํฌ๋ฆฝํŠธ


80๋…„๋Œ€์˜ ๊ทธ๊ฒŒ์ž„์ฒ˜๋Ÿผ ๊ณต์€ ๋Œ€๊ฐ์„ ๋ฐฉํ–ฅ์œผ๋กœ ์›€์ง์ด๋‹ค๊ฐ€ย  ๋ฒฝ์„๋งŒ๋‚˜๋ฉด Y๋ฐฉํ–ฅ์ด ๋ฐ”๋€Œ๊ณ ย  ํ”Œ๋ ˆ์ด์–ด(ํŒ๋„ฌ)์„ ๋งŒ๋‚˜๋ฉด X๋ฐฉํ–ฅ์ด ๋ฐ”๋€œ


์•„๋ž˜์ฒ˜๋Ÿผ collision.gameObject<ํ”Œ๋ ˆ์ด์–ดor๋ฒฝ> ์„ ๊ณ„์† ์จ์„œ ๋งŒ๋‚œ๋Œ€์ƒ์ด ๋ˆ„๊ตฌ์ธ์ง€ ํŒ๋ณ„ํ•˜๊ณ ย  ๋กœ์ง์„ ์ ์šฉํ•˜๋Š”๋ฐ

์ด๊ฒƒ๋ณด๋‹ค ์ข‹์€ ๋ฐฉ๋ฒ•์ด ๋ถ„๋ช… ์žˆ์„๊ฑฐ๋ผ๋Š” ์ƒ๊ฐ์ด ๋“ฌ


๋ณต์žกํ•œ ๋Œ€์ƒ์€ ๋งŒ๋‚˜์•ผ๋˜๋Š” ๋Œ€์ƒ์ด 100๊ฐœ๋Š” ๋„˜์–ด๊ฐˆํ…๋ฐ 100๊ฐœ๋ฅผ ๋‹ค if๋Œ๋ฆฌ๊ณ  ์žˆ์ง€๋Š” ์•Š์„๊ฒƒ๊ฐ™์œผ..



private Vector2 _direction;private void OnCollisionEnter2D(Collision2D col)
{
PlayerPanCon tempPlayerPanCon = col.gameObject.GetComponent<PlayerPanCon>();
Wall tempWall = col.gameObject.GetComponent<Wall>();

if (tempPlayerPanCon != null) _direction = new Vector2(_direction.x * -1, _direction.y);
if( tempWall != null ) _direction = new Vector2(_direction.x , _direction.y * -1);
}