Ejemplo n.º 1
0
        public void Prepare(Entity entity, Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            for (int spawnPointCounter = 0; spawnPointCounter < LocalCreatureSpawnPoints.Count; spawnPointCounter++)
            {
                NitroxVector3 localSpawnPosition   = LocalCreatureSpawnPoints[spawnPointCounter];
                float         targetProbabilitySum = (float)deterministicBatchGenerator.NextDouble() * creatureProbabiltySum;
                float         probabilitySum       = 0;

                foreach (ReefbackEntity creature in SpawnableCreatures)
                {
                    probabilitySum += creature.probability;

                    if (probabilitySum >= targetProbabilitySum)
                    {
                        int totalToSpawn = deterministicBatchGenerator.NextInt(creature.minNumber, creature.maxNumber + 1);

                        for (int i = 0; i < totalToSpawn; i++)
                        {
                            NitroxId id    = deterministicBatchGenerator.NextId();
                            Entity   child = new Entity(localSpawnPosition, new NitroxQuaternion(0, 0, 0, 1), new NitroxVector3(1, 1, 1), creature.techType.ToDto(), entity.Level, creature.classId, true, id, null, parentEntity);
                            entity.ChildEntities.Add(child);
                        }

                        break;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void Prepare(Entity entity, Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            Entity crashFish = SpawnChild(entity, deterministicBatchGenerator, TechType.Crash, "7d307502-46b7-4f86-afb0-65fe8867f893");

            crashFish.Transform.LocalRotation = new NitroxQuaternion(-0.7071068f, 0, 0, 0.7071068f);
            entity.ChildEntities.Add(crashFish);
        }
Ejemplo n.º 3
0
        public void Prepare(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            for (int spawnPointCounter = 0; spawnPointCounter < LocalCreatureSpawnPoints.Count; spawnPointCounter++)
            {
                Vector3 localSpawnPosition   = LocalCreatureSpawnPoints[spawnPointCounter];
                float   targetProbabilitySum = (float)deterministicBatchGenerator.NextDouble() * creatureProbabiltySum;
                float   probabilitySum       = 0;

                foreach (ReefbackEntity creature in SpawnableCreatures)
                {
                    probabilitySum += creature.probability;

                    if (probabilitySum >= targetProbabilitySum)
                    {
                        int totalToSpawn = deterministicBatchGenerator.NextInt(creature.minNumber, creature.maxNumber + 1);

                        for (int i = 0; i < totalToSpawn; i++)
                        {
                            string guid  = deterministicBatchGenerator.NextGuid();
                            Entity child = new Entity(parentEntity.Position + localSpawnPosition, parentEntity.Rotation, parentEntity.Scale, creature.techType.Model(), parentEntity.Level, creature.classId, true, guid);
                            parentEntity.ChildEntities.Add(child);
                        }

                        break;
                    }
                }
            }
        }
        public void Prepare(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            Entity crashFish = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.Crash, "7d307502-46b7-4f86-afb0-65fe8867f893");

            parentEntity.ChildEntities.Add(crashFish);

            Entity crashPower = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.CrashPowder, "1ce074ee-1a58-439b-bb5b-e5e3d9f0886f");

            parentEntity.ChildEntities.Add(crashPower);
        }
Ejemplo n.º 5
0
        public void Prepare(Entity entity, Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            bool hasCellRootAsParent = (parentEntity != null && parentEntity.ClassId == cellRootClassId);

            if (hasCellRootAsParent && parentEntity.Level < entity.Level)
            {
                // bump the cell root up to the child's visibility level
                parentEntity.Level = entity.Level;
            }
        }
Ejemplo n.º 6
0
        public void Prepare(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            Entity crashFish = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.Crash);

            parentEntity.ChildEntities.Add(crashFish);

            Entity crashPower = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.CrashPowder);

            parentEntity.ChildEntities.Add(crashPower);
        }
Ejemplo n.º 7
0
        public void Prepare(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator)
        {
            Entity crashFish = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.Crash, "7d307502-46b7-4f86-afb0-65fe8867f893");

            crashFish.Transform.LocalRotation = new NitroxQuaternion(-0.7071068f, 0, 0, 0.7071068f);
            parentEntity.ChildEntities.Add(crashFish);

            Entity crashPowder = SpawnChild(parentEntity, deterministicBatchGenerator, TechType.CrashPowder, "1ce074ee-1a58-439b-bb5b-e5e3d9f0886f");

            parentEntity.ChildEntities.Add(crashPowder);
        }
Ejemplo n.º 8
0
        private Entity SpawnChild(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator, TechType techType, string classId)
        {
            NitroxId id = deterministicBatchGenerator.NextId();

            return(new Entity(new NitroxVector3(0, 0, 0), new NitroxQuaternion(0, 0, 0, 1), new NitroxVector3(1, 1, 1), techType.ToDto(), parentEntity.Level, classId, true, id, null, parentEntity));
        }
Ejemplo n.º 9
0
        private Entity SpawnChild(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator, TechType techType, string classId)
        {
            NitroxId id = deterministicBatchGenerator.NextId();

            return(new Entity(parentEntity.Position, parentEntity.Rotation, new UnityEngine.Vector3(1, 1, 1), techType.Model(), parentEntity.Level, classId, true, id));
        }
Ejemplo n.º 10
0
        private Entity SpawnChild(Entity parentEntity, DeterministicBatchGenerator deterministicBatchGenerator, TechType techType)
        {
            string guid = deterministicBatchGenerator.NextGuid();

            return(new Entity(parentEntity.Position, parentEntity.Rotation, techType, parentEntity.Level, parentEntity.ClassId, true, guid));
        }