示例#1
0
        private void SpawnMonster(Entity e, SkillDatam datam)
        {
            if (World.EntityManager.HasComponent <CharacterRaycaster>(e) == false)
            {
                return;
            }
            int   monsterID               = datam.monster.Value.id;
            ZoxID zoxID                   = World.EntityManager.GetComponentData <ZoxID>(e);
            CharacterRaycaster caster     = World.EntityManager.GetComponentData <CharacterRaycaster>(e);
            WorldBound         worldBound = World.EntityManager.GetComponentData <WorldBound>(e);

            if (caster.DidCast() == 1)
            {
                ZoxID stats = World.EntityManager.GetComponentData <ZoxID>(e);
                //caster.triggered = 1;
                World.EntityManager.SetComponentData(e, caster);
                int clanID = stats.clanID;
                if (datam.Value.isSpawnHostile == 1)
                {
                    clanID = Bootstrap.GenerateUniqueID();
                }
                CharacterSpawnSystem.SpawnNPC(World.EntityManager, worldBound.world, monsterID, clanID, caster.voxelPosition, zoxID.id);

                /*if (datam.Value.isSpawnHostile != 1)
                 * {
                 *  Entity npc = characterSpawnSystem.characters[spawnedID];
                 *  ZoxID spawnedZoxID = World.EntityManager.GetComponentData<ZoxID>(npc);
                 *  spawnedZoxID.creatorID = zoxID.id;
                 *  World.EntityManager.SetComponentData(npc, spawnedZoxID);
                 * }*/
                AudioManager.instance.PlaySound(datam.audio, caster.voxelPosition);
                //Debug.LogError("Spawning Turret at: " + caster.voxelPosition.ToString());
            }
        }
示例#2
0
        private void SpawnVoxel(Entity e, VoxelDatam voxelMeta)
        {
            CharacterRaycaster caster     = World.EntityManager.GetComponentData <CharacterRaycaster>(e);
            WorldBound         worldBound = World.EntityManager.GetComponentData <WorldBound>(e);

            if (caster.DidCast() == 1)
            {
                //Debug.LogError("Spawning voxel at: " + caster.voxelPosition.ToString());
                VoxelSpawnSystem.QueueVoxel(caster.voxelPosition, worldBound.world, voxelMeta.Value.id);
            }
        }
示例#3
0
        private void SpawnTurret(Entity e, int turretID)
        {
            CharacterRaycaster caster = World.EntityManager.GetComponentData <CharacterRaycaster>(e);

            if (caster.DidCast() == 1)
            {
                ZoxID stats = World.EntityManager.GetComponentData <ZoxID>(e);
                TurretSpawnerSystem.QueueTurret(caster.voxelPosition, turretID, stats.clanID);
                //caster.triggered = 1;
                //World.EntityManager.SetComponentData(e, caster);
                //Debug.LogError("Spawning Turret at: " + caster.voxelPosition.ToString());
            }
        }