Beispiel #1
0
    /// <summary>
    /// Spawns the things defined in this list at the indicated destination
    /// </summary>
    /// <param name="destination"></param>
    public SpawnableResult SpawnAt(SpawnDestination destination)
    {
        if (!SpawnableUtils.IsValidDestination(destination))
        {
            return(SpawnableResult.Fail(destination));
        }

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

        foreach (var prefab in contents)
        {
            var result = Spawn.ServerPrefab(prefab, destination);
            if (!result.Successful)
            {
                Logger.LogWarningFormat("An item in SpawnableList {0} is missing, please fix prefab reference.", Category.ItemSpawn,
                                        name);
            }
            else
            {
                spawned.AddRange(result.GameObjects);
            }
        }

        return(SpawnableResult.Multiple(spawned, destination));
    }