원 공격 하기
public float angle = 1f;
public float count = 10;
private int cal = 0;
void Skill ()
{
StartCoroutine (Fire ());
}
private IEnumerator Fire ()
{
Vector3 pointPos;
for (int j = 0; j < count; j++) {
float pointNum = (j * 1.0f) / count;
float angle = pointNum * Mathf.PI * 2;
float x = Mathf.Sin (angle) * (1 + cal);
float y = Mathf.Cos (angle) * (1 + cal);
pointPos = new Vector3 (x, 0.5f, y) + transform.position;
ObjectPoolUtil.CreateClone (attackPrefab, pointPos, Quaternion.identity);
}
}
'Game > Unity' 카테고리의 다른 글
[unity3d] 파일사이즈 줄이기 (Reducing File Size) (0) | 2015.01.08 |
---|---|
[unity3d] homing (0) | 2015.01.07 |
[Unity3D]Physics.OverlapSphere 예제 (0) | 2014.11.26 |
[Unity3D] NGUI와 BMFont를 이용한 데미지(숫자) 폰트 만들기 (0) | 2014.11.18 |
[NGUI] ScrollView 만들기 (0) | 2014.11.06 |