/// Spawns a unit based on the level set. private void SpawnUnit() { if (unitList[(int)unitLevel] != null) { Transform unit = InstanceManager.Spawn(unitList[(int)unitLevel].transform, spawnLocation.position, Quaternion.identity); unit.GetComponent <SpawnAI>().SetOwner(this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfUnits++; totalSpawnedUnits++; } else { Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set"); spawn = false; } }
/// <summary> /// Spawns a unit based on the level set. /// </summary> private void SpawnUnit() { if (unitList[(int)unitLevel] != null) { spawnPointIndex = Random.Range(0, spawnPoints.Length); Transform unit = InstanceManager.Spawn(unitList[(int)unitLevel].transform, spawnPoints[spawnPointIndex].position, spawnPoints[spawnPointIndex].rotation); unit.GetComponent <SpawnAI>().SetOwner(this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfUnits++; totalSpawnedUnits++; } else { Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set"); spawn = false; } }
/// <summary> /// Spawns a unit based on the level set. /// </summary> private void SpawnUnit() { if (GameManager.Instance.PauseGame) { return; } if (unitList[(int)unitLevel] != null) { Transform unit = InstanceManager.Spawn(unitList[(int)unitLevel].transform, spawnLocation.position, Quaternion.identity); //↓↓↓ここからオリジナルソースコード追加↓↓↓// int id = GameManager.Instance.crntEnemyDictionary.Count + 1; unit.gameObject.GetComponent <EnemyObject> ().EnemyData = _enemyData; unit.gameObject.GetComponent <EnemyObject> ().CurrentHP = _enemyData.HP; timeBetweenSpawns = _enemyData.Interval; //ドロップの設定 GameObject stgObj = GameManager.Instance.CurrentStageObject; if (stgObj != null) { DropData dropData = stgObj.GetComponent <StageObject> ().MakeDrop(); if (dropData != null) { unit.gameObject.GetComponent <EnemyObject> ().dropData = dropData; } } GameManager.Instance.crntEnemyDictionary.Add(id.ToString(), unit.gameObject.GetComponent <EnemyObject> ()); //↑↑↑==========ここまで===========↑↑↑// unit.GetComponent <SpawnAI>().SetOwner(this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfUnits++; totalSpawnedUnits++; } else { Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set"); spawn = false; } }
/// <summary> /// Spawns a unit based on the level set. /// </summary> private void SpawnUnit() { int unitToSpawn = Random.Range(0, unitList[(int)unitLevel].units.Length); if (unitList[(int)unitLevel].units[unitToSpawn] != null) { int locationToSpawn = Random.Range(0, spawnLocations.Length); Transform unit = InstanceManager.Spawn(unitList[(int)unitLevel].units[unitToSpawn].transform, spawnLocations[locationToSpawn].position, Quaternion.identity); unit.SendMessage("SetOwner", this); // Increase the total number of enemies spawned and the number of spawned enemies numberOfSpawnedUnits++; totalSpawnedUnits++; } else { Debug.LogError("Error trying to spawn unit of level " + unitLevel.ToString() + " on spawner " + spawnID + " - No unit set"); if (unitList[(int)unitLevel].units.Length == 1) { spawn = false; } } }