コード例 #1
0
        private void SpawnPath(LuzSpawnerPath spawnerPath)
        {
            var obj = InstancingUtilities.Spawner(spawnerPath, this);

            if (obj == null)
            {
                return;
            }

            obj.Layer = StandardLayer.Hidden;

            var spawner = obj.GetComponent <SpawnerComponent>();

            spawner.SpawnsToMaintain = (int)spawnerPath.NumberToMaintain;

            spawner.SpawnLocations = spawnerPath.Waypoints.Select(w => new SpawnLocation
            {
                Position = w.Position,
                Rotation = Quaternion.Identity
            }).ToList();

            Start(obj);

            spawner.SpawnCluster();
        }
コード例 #2
0
ファイル: InstancingUtil.cs プロジェクト: DigitalData/Uchu
        public static GameObject Spawner(LuzSpawnerPath spawnerPath, Object parent)
        {
            if (!spawnerPath.Waypoints.Any())
            {
                return(null);
            }

            var wayPoint = (LuzSpawnerWaypoint)spawnerPath.Waypoints[0];

            var spawner = GameObject.Instantiate(
                parent,
                spawnerPath.PathName,
                wayPoint.Position,
                wayPoint.Rotation,
                -1,
                spawnerPath.SpawnerObjectId,
                Lot.Spawner
                );

            /* TODO :
             *
             * var settings = new LegoDataDictionary();
             * foreach (var config in wayPoint.Configs)
             * {
             *  settings.Add(config.ConfigName, config.ConfigTypeAndValue);
             * }
             *
             * spawner.Settings = settings;
             */

            spawner.Settings.Add("respawn", spawnerPath.RespawnTime);

            var spawnerComponent = spawner.AddComponent <SpawnerComponent>();

            spawnerComponent.Settings      = spawner.Settings;
            spawnerComponent.SpawnTemplate = (int)spawnerPath.SpawnedLot;
            spawnerComponent.LevelObject   = new LevelObjectTemplate
            {
                Scale = 1
            };

            return(spawner);
        }
コード例 #3
0
        public static SpawnerNetwork SpawnerNetwork(LuzSpawnerPath spawnerPath, Zone zone)
        {
            var network = Object.Instantiate <SpawnerNetwork>(zone);

            network.ActivateOnLoad          = spawnerPath.ActivateSpawnerNetworkOnLoad;
            network.MaxToSpawn              = spawnerPath.MaxSpawnCount;
            network.RespawnTime             = spawnerPath.RespawnTime * 1000;
            network.SpawnsToMaintain        = spawnerPath.NumberToMaintain;
            network.InitialSpawnsToMaintain = spawnerPath.NumberToMaintain;
            network.Name = spawnerPath.PathName;

            foreach (var pathWaypoint in spawnerPath.Waypoints)
            {
                var spawnerWaypoint = (LuzSpawnerWaypoint)pathWaypoint;

                var spawnerSettings = spawnerWaypoint.Configs;

                var spawnerNode = Spawner(new LevelObjectTemplate
                {
                    LegoInfo = spawnerSettings,
                    Position = spawnerWaypoint.Position,
                    Rotation = spawnerWaypoint.Rotation,
                    Scale    = -1,
                    Lot      = Lot.Spawner,
                    ObjectId = (ObjectId)spawnerPath.SpawnerObjectId,
                }, zone);

                var spawnerComponent = spawnerNode.GetComponent <SpawnerComponent>();
                spawnerComponent.SpawnerNodeId = Convert.ToUInt32((int)spawnerSettings["spawner_node_id"]);
                spawnerComponent.Network       = network;

                network.AddSpawnerNode(spawnerComponent);
            }

            return(network);
        }
コード例 #4
0
 public static GameObject Spawner(LuzSpawnerPath spawnerPath, Object parent)
 {
     if (spawnerPath.Waypoints.Length == default)
     {
         return(default);