RemarkableDisastrousBassethound-size_restricted.gif



using System.Collections;

using System.Collections.Generic;

using UnityEngine;


public class mortar : MonoBehaviour

{

public GameObject mortarshell;

public Transform muzzle;

public Transform mortarRange;

private Transform c;

List<GameObject> mortarshellList = new List<GameObject>();


// Start is called before the first frame update

void Start()

{

}


// Update is called once per frame

void Update()

{


}


public void Fire()

{

float a = Random.Range(-1.0f, 1.0f);

float b = Random.Range(-1.0f, 1.0f);

GameObject temp = Instantiate(mortarshell, muzzle.position, Quaternion.identity);

mortarshellList.Add(temp);

for(int i=0;i<mortarshellList.Count;i++)

{

mortarshell _mortarshell = mortarshellList[i].GetComponent<mortarshell>();

_mortarshell.start = muzzle;

_mortarshell.end = mortarRange;

//c.transform.position = new Vector3(mortarRange.transform.position.x + a, mortarRange.transform.position.y + b, mortarRange.transform.position.z);

//_mortarshell.end.transform.position = c.transform.position;

}

}

}


์ง€๊ธˆ์€ ์›€์งค์— ๋ณด์ด๋Š” ๋นจ๊ฐ„์ƒ‰ ์ € ๊ฐ€์šด๋ฐ ๋ถ€์œ„์—๋งŒ ํฌํƒ„์ด ๋ฐ•ํžˆ๊ฑฐ๋“ ์š”.
๊ทผ๋ฐ ๋žœ๋ค ์š”์†Œ๋ฅผ ์กฐ๊ธˆ ์ค˜์„œ ์กฐ๊ธˆ์”ฉ ๋‹ค๋ฅธ ๊ณณ์—๋„ ํฌํƒ„์ด ๋–จ์–ด์ง€๋„๋ก ์ˆ˜์ •ํ•˜๊ณ  ์‹ถ์€๋ฐ
mortarshell.end ์ด๊ฒŒ ๋–จ์–ด์ง€๋Š” ๋ชฉํ‘œ์œ„์น˜ ํŠธ๋žœ์Šคํผ ๋ณ€์ˆ˜ ๊ฑฐ๋“ ์š”.
์ด๊ฑธ ์–ด๋–ป๊ฒŒ ์ˆ˜์ •ํ•ด์•ผํ• ๊นŒ์š”?