something is no yes
This commit is contained in:
@@ -1,31 +1,24 @@
|
||||
using RebootKit.Engine.Simulation;
|
||||
using RebootReality.jelycho.Enemies;
|
||||
using RebootKit.Engine.Main;
|
||||
using RebootKit.Engine.Simulation;
|
||||
using RebootReality.jelycho.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RebootReality.jelycho.Items {
|
||||
public class ItemQuickAttackAction : IItemQuickAttackAction {
|
||||
static readonly Collider[] s_CollidersBuffer = new Collider[512];
|
||||
|
||||
public void Attack(Actor attacker, ItemActor itemActor) {
|
||||
if (RR.World.Context is not WorldContext worldContext) {
|
||||
return;
|
||||
}
|
||||
|
||||
PlayerActor playerActor = attacker as PlayerActor;
|
||||
if (playerActor == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
Vector3 attackPosition = playerActor.GetAttackPosition();
|
||||
float attackRadius = 1.0f;
|
||||
|
||||
int count = Physics.OverlapSphereNonAlloc(attackPosition, 3.0f, s_CollidersBuffer);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
if (s_CollidersBuffer[i].TryGetComponent(out IKillable killable)) {
|
||||
Actor killableActor = killable as Actor;
|
||||
if (killableActor == attacker) {
|
||||
continue;
|
||||
}
|
||||
|
||||
playerActor.DealDamage(killable);
|
||||
}
|
||||
}
|
||||
worldContext.HitboxManager.HitSphere(attackPosition, attackRadius, attacker, itemActor.Config.baseDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user