public override void SimulatePlayerFixedUpdate(Actor_Player actor) { actor.fTimeSinceLastAttack += Core.GetPlayerDeltaTime(); //if (actor.currentTarget == null || actor.currentTarget.minion.fCurrentHealth <= 0.0f) { // Find new target actor.currentTarget = GetBestTarget(actor); } if (actor.minion.slot == MinionSlot.RANGED_1) { Actor_Player otherRangedMinion = Core.GetLevel().playerActors [(int)MinionSlot.RANGED_2]; if (otherRangedMinion.fTimeSinceLastAttack >= fAttackInterval) { actor.fTimeSinceLastAttack = fAttackInterval * 0.5f; } } int iSlot = actor.minion.slot == MinionSlot.RANGED_1 ? 0 : 1; Transform reticule = Core.GetLevel().instance.targets [iSlot]; Transform radius = Core.GetLevel().instance.radii [iSlot]; if (actor.currentTarget != null) { reticule.gameObject.SetActive(true); reticule.position = Vector3.Lerp(reticule.position, actor.currentTarget.transform.position + new Vector3(0.0f, 0.04f, 0.0f), Core.GetPlayerDeltaTime() * actor.minion.template.reticuleMoveSpeed * actor.GetAttackSpeedMultiplier()); float fRadius = damage.fRadius * actor.GetAttackRadiusMultiplier() * 2.0f; radius.localScale = new Vector3(fRadius, 1.0f, fRadius); if (!actor.currentTarget.IsInRangedZone()) { actor.currentTarget = null; } else if (actor.fTimeSinceLastAttack >= fAttackInterval * actor.GetAttackSpeedMultiplier()) { actor.fTimeSinceLastAttack = 0.0f; // Spawn a projectile for (int i = 0; i < numAttacks; i++) { Projectile projectile = Instantiate <Projectile>(projectilePrefab); projectile.firer = actor; projectile.firerTemplate = this; projectile.launchPos = actor.transform.position + new Vector3(0.5f * i, fProjectileLaunchHeight, 0.0f); projectile.fProgress = i * 0.1f; projectile.target = actor.currentTarget; projectile.transform.position = projectile.launchPos; } PlaySoundEffect(actor); actor.render.SetAnimStateAndNext(AnimState.ATTACK, AnimState.IDLE); } } else { //reticule.gameObject.SetActive(false); } }
protected bool DealDamageToEnemy(Actor_Player player, Actor_Enemy enemy, Vector3 position, float fRadius) { float fMultiplier = player.GetAttackDamageMultiplier(); if (position.x <= Core.GetLevel().GetMeleeZoneLimit()) { fMultiplier += player.minion.GetBuff(Stat.DAMAGE_MULTIPLIER_IN_MELEE_ZONE); } if (enemy.IsStunned()) { fMultiplier += player.minion.GetBuff(Stat.ATTACK_DAMAGE_ON_STUNNED_ENEMIES); } if (damage.IsRadial()) { Core.GetLevel().DamageRadius(damage, position, damage.fRadius * player.GetAttackRadiusMultiplier(), fMultiplier, player.GetStunTime(), player.minion.GetBuff(Stat.CRITICAL_CHANCE), player.minion.GetBuff(Stat.CRITICAL_DAMAGE), player.minion.GetBuff(Stat.VAMPIRISM), player.minion.GetBuff(Stat.ATTACK_DAMAGE_ABSOLUTE)); return(enemy == null || enemy.IsDead()); } else if (enemy != null) { if (enemy.IsDead()) { return(true); } float fElementalMultiplier = Elements.GetDamageMultiplier(damage.GetElement(), enemy.minion.template.element); float fMod = enemy.GetInherentElementalResistanceModifier(); if (fElementalMultiplier < 1.0f) { fElementalMultiplier = 1.0f - ((1.0f - fElementalMultiplier) * fMod); } fMultiplier *= fElementalMultiplier; player.OnDealtDamage(damage.fAmount * fMultiplier); return(enemy.Damage(damage, fMultiplier, player.GetStunTime(), player.minion.GetBuff(Stat.CRITICAL_CHANCE), player.minion.GetBuff(Stat.CRITICAL_DAMAGE), player.minion.GetBuff(Stat.VAMPIRISM), player.minion.GetBuff(Stat.ATTACK_DAMAGE_ABSOLUTE))); } return(true); }
public override void SimulatePlayerFixedUpdate(Actor_Player actor) { if (damage.fAmount > 0.0f || damage.fPushAmount > 0.0f) // 0 means no attack { actor.fTimeSinceLastAttack += Core.GetPlayerDeltaTime(); if (actor.currentTarget == null || actor.currentTarget.minion.fCurrentHealth <= 0.0f || !actor.currentTarget.IsInMeleeZone()) { actor.currentTarget = null; // Find new target Actor_Enemy closestEnemy = Core.GetLevel().GetClosestEnemyToMeleeZone(); if (closestEnemy != null && closestEnemy.IsInMeleeZone()) { actor.currentTarget = closestEnemy; } else { // No valid target. } } int iSlot = actor.minion.slot == MinionSlot.MELEE_1 ? 0 : 1; Transform reticule = Core.GetLevel().instance.meleeTargets [iSlot]; Transform radius = Core.GetLevel().instance.meleeRadii [iSlot]; if (actor.currentTarget != null) { reticule.gameObject.SetActive(true); reticule.position = Vector3.Lerp(reticule.position, actor.currentTarget.transform.position + new Vector3(0.0f, 0.04f, 0.0f), Core.GetPlayerDeltaTime() * actor.minion.template.reticuleMoveSpeed * actor.GetAttackSpeedMultiplier()); float fRadius = damage.fRadius * actor.GetAttackRadiusMultiplier() * 2.0f; radius.localScale = new Vector3(fRadius, 1.0f, fRadius); if (TryToAttackEnemy(actor, actor.currentTarget)) { // We killed them actor.currentTarget = null; } } else { //reticule.gameObject.SetActive(false); } } }
public override void SimulatePlayerFixedUpdate(Actor_Player actor) { actor.fTimeSinceLastAttack += Core.GetPlayerDeltaTime(); //if (actor.currentTarget == null || actor.currentTarget.minion.fCurrentHealth <= 0.0f) { // Find new target actor.currentTarget = GetBestTarget(actor); } if (bLoopingSoundEffect && !actor.soundEffect.isPlaying) { actor.soundEffect.loop = true; actor.soundEffect.clip = soundEffect; actor.soundEffect.Play(); } if (actor.currentTarget != null) { int iSlot = actor.minion.slot == MinionSlot.RANGED_1 ? 0 : 1; Transform reticule = Core.GetLevel().instance.targets [iSlot]; Transform radius = Core.GetLevel().instance.radii [iSlot]; reticule.gameObject.SetActive(true); reticule.position = Vector3.Lerp(reticule.position, actor.currentTarget.transform.position + new Vector3(0.0f, 0.04f, 0.0f), Core.GetPlayerDeltaTime() * actor.minion.template.reticuleMoveSpeed * actor.GetAttackSpeedMultiplier()); float fRadius = damage.fRadius * actor.GetAttackRadiusMultiplier() * 2.0f; radius.localScale = new Vector3(fRadius, 1.0f, fRadius); if (actor.iNumHitsWithSummon >= iNumHits) { actor.summon.PlayDeathAnimation(); actor.summon = null; actor.iNumHitsWithSummon = 0; reticule.position = actor.currentTarget.transform.position + new Vector3(0.0f, 0.04f, 0.0f); } if (actor.summon == null) { // TODO : Do spawn PFX actor.summon = Instantiate <RenderActor>(summonPrefab); actor.summon.transform.SetParent(reticule); actor.summon.transform.localPosition = new Vector3(0.0f, fSummonHeight, 0.0f); if (summonEffect != null) { summonEffect.Play(); } } if (!actor.currentTarget.IsInRangedZone()) { actor.currentTarget = null; } else if (actor.fTimeSinceLastAttack >= fAttackInterval * actor.GetAttackSpeedMultiplier()) { actor.fTimeSinceLastAttack = 0.0f; if (!bLoopingSoundEffect) { PlaySoundEffect(actor); } if (DealDamageToEnemy(actor, actor.currentTarget, actor.currentTarget.transform.position, 0.0f)) { // We killed them actor.currentTarget = null; } actor.iNumHitsWithSummon++; actor.summon.SetAnimStateAndNext(AnimState.ATTACK, AnimState.IDLE); } } }