/// <summary> /// Attempts to spawn an item at a spawn point. /// If successful the return value will be true otherwise false. /// </summary> /// <param name="toSpawn">The transform of the object to spawn</param> /// <returns>True if the spawn was successful otherwise false</returns> public virtual bool spawn(Transform toSpawn) { #if ULTIMATE_SPAWNER_NETWORKED == true if (isServer == false) { NetError.raise(); } #endif // Check if we can spawn if (canSpawn() == false) { // Trigger failed invokeSpawnFailedEvent(); return(false); } // Get the spawn point ISpawn spawn = this.selectSpawn(spawnMode); // Get the spawn info SpawnInfo info = spawn.getSpawnInfo(); // Spawn the item info.spawnObjectAt(toSpawn); // Success invokeSpawnedEvent(toSpawn); return(true); }
/// <summary> /// Returns an instance of the spawn info class representing a free spawn point at the time of calling this method. /// This can be used to access the location and rotation of the spawn point for manual spawning. /// </summary> /// <returns>An instance of the spawn info class representing a specific spawn location</returns> public override SpawnInfo getSpawnInfo() { #if ULTIMATE_SPAWNER_NETWORKED == true if (isServer == false) { NetError.raise(); } #endif // Select a spawn using the spawn mode ISpawn spawn = this.selectSpawn(spawnMode); // Check for null if (spawn == null) { return(null); } // Get the spawn info return(spawn.getSpawnInfo()); }