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()); } }
public void Initialize(Unity.Entities.World space) { characterSpawnSystem = space.GetOrCreateSystem <CharacterSpawnSystem>(); characterDeathSystem = space.GetOrCreateSystem <CharacterDeathSystem>(); turretSpawnSystem = space.GetOrCreateSystem <TurretSpawnerSystem>(); AddSystemToUpdateList(characterSpawnSystem); AddSystemToUpdateList(characterDeathSystem); AddSystemToUpdateList(turretSpawnSystem); SetLinks(); }
public void SpawnCharacters() { CharacterSpawnSystem.SpawnNPCs(EntityManager, World, character.Value.id, clanToSpawn, spawnPosition, amountToSpawn); }