GameObject Create(int enemyPos = -1) { //エネミー生成 if (enemyPos == -1) { enemyPos = Random.Range((int)0, (int)_lane.GetLaneNum()); } Vector3 pos = _lanePos[enemyPos] + new Vector3(0, _laneSizeY, 0); return(Instantiate(enemyObject, pos, new Quaternion(0, 0, 0, 0)) as GameObject); }
void Update() { //エネミー生成 _time -= Time.deltaTime; if (_time <= 0.0) { _time = createSpeed; //エネミー生成 _randomInt = Random.Range((int)0, (int)_lane.GetLaneNum()); Vector3 pos = _lanePos[_randomInt] + new Vector3(0, _laneSizeY, 0); Instantiate(enemyObject, pos, new Quaternion(0, 0, 0, 0)); } }
void Update() { //エネミー生成 _time -= Time.deltaTime; if (_time <= 0.0) { _time = createSpeed; //エネミー生成 _randomInt = Random.Range((int)0, (int)_lane.GetLaneNum()); Vector3 pos = new Vector3(_lanePos[_randomInt], _DEFAULT_POS_Y, 0); Debug.Log("僕の場所は" + pos); Instantiate(enemyObject, pos, new Quaternion(0, 0, 0, 0)); } }