float GetDebuffDuration(SpellIds spell) { if (spell == SpellIds.IceBlast) { return(GameDataManager.instance.IceBlastDuration); } return(0); }
int GetSpellDamage(SpellIds spell) { if (spell == SpellIds.FireStrike) { return(GameDataManager.instance.FireStrikeDamage); } return(0); }
public void CastSpell(KeyCode keyForSpell, SpellIds spell, float spellCooldown) { if (this.IsLevel() && !GameController.instance.isPaused) { float deltaTime = Time.DeltaTime; var muzzleOffset = new float3(0, GameDataManager.instance.EnemyLevelY, 1); var casting = Input.GetKeyDown(keyForSpell); if (cooldownTimer <= 0 && casting) { Entities .WithoutBurst() .WithStructuralChanges() .ForEach((ref PlayerData player, ref Translation position, ref Rotation rotation) => { Entity prefab; switch (spell) { case SpellIds.FireStrike: prefab = player.fireStrikePrefab; break; case SpellIds.IceBlast: prefab = player.iceBlastPrefab; break; default: throw new System.ArgumentException($"Unknown spell: {spell}"); } var spellEntity = World.EntityManager.Instantiate(prefab); this.SetCreatedProjectileTransforms( projectileEntity: spellEntity, muzzleOffset: muzzleOffset, shooterPostion: position.Value, shooterRotation: rotation.Value); EntityManager.AddBuffer <EnemyBySpellIndexBufferElement>(spellEntity); cooldownTimer = spellCooldown; }) .Run(); } else { cooldownTimer -= Time.DeltaTime; } } }
protected void ExecuteSpellTriggerJob <T>(SpellIds spell) where T : struct, IComponentData { if (this.IsLevel()) { var jobHandle = new SpellTriggerJob <T> { SpellDataGroup = GetComponentDataFromEntity <T>(), EnemyDataGroup = GetComponentDataFromEntity <EnemyData>(), EnemyBySpellIndexBufferElementGroup = GetBufferFromEntity <EnemyBySpellIndexBufferElement>(), SpellDamage = GetSpellDamage(spell), DebuffDuration = GetDebuffDuration(spell), SpellId = (int)spell, } .Schedule(stepWorld.Simulation, ref physicsWorld.PhysicsWorld, Dependency); jobHandle.Complete(); } }
public Blastranaar(Dictionary <string, string> args) : base(args) { QBCLog.BehaviorLoggingContext = this; try { QuestId = 30232;//GetAttributeAsQuestId("QuestId", true, null) ?? 0; SpellIds = GetNumberedAttributesAsArray <int>("SpellId", 1, ConstrainAs.SpellId, null); SpellId = SpellIds.FirstOrDefault(SpellManager.HasSpell); } catch (Exception except) { // Maintenance problems occur for a number of reasons. The primary two are... // * Changes were made to the behavior, and boundary conditions weren't properly tested. // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes. // In any case, we pinpoint the source of the problem area here, and hopefully it // can be quickly resolved. QBCLog.Exception(except); IsAttributeProblem = true; } }