public void PerformAttack(Character targetCharacter) { if (targetCharacter.Type == CharacterType.NPC) { Target = EcsEntity.Null; return; } var targetEntity = targetCharacter.Entity.Get <CombatEntity>(); if (!targetEntity.IsValidTarget(CombatEntity)) { ClearTarget(); return; } Character.StopMovingImmediately(); if (Character.AttackCooldown > Time.ElapsedTimeFloat) { QueueAttack = true; Target = targetCharacter.Entity; return; } Character.SpawnImmunity = -1; CombatEntity.PerformMeleeAttack(targetEntity); QueueAttack = true; Character.AttackCooldown = Time.ElapsedTimeFloat + CombatEntity.Stats.AttackMotionTime; }
private bool OutPerformAttack() { var targetEntity = targetCharacter.Entity.Get <CombatEntity>(); if (!targetEntity.IsValidTarget(CombatEntity)) { return(false); } CombatEntity.PerformMeleeAttack(targetEntity); nextAiUpdate += MonsterBase.AttackTime; return(true); }