1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "BITFALL.Melee",
|
||||
"name": "BITFALL.Melee.Runtime",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
@@ -43,35 +43,44 @@ namespace BITFALL.Melee
|
||||
var damaged= new List<IEntity>();
|
||||
foreach (var x in colliders.Where(x=>x.GetComponent<IDamagable>() is not null))
|
||||
{
|
||||
var damageable = x.GetComponent<IDamagable>();
|
||||
if (damaged.Contains(damageable.Entity) || damageable.Entity.Id == command.PlayerId)
|
||||
try
|
||||
{
|
||||
continue;
|
||||
}
|
||||
damaged.Add(damageable.Entity);
|
||||
damageable.GiveDamage(new DamageMessage()
|
||||
{
|
||||
initiator = UnityEntitiesService.Get(command.PlayerId) as IEntity,
|
||||
damageType = new MeleeDamageMessage
|
||||
var damageable = x.GetComponent<IDamagable>();
|
||||
if (damaged.Contains(damageable.Entity) || damageable.Entity.Id == command.PlayerId)
|
||||
{
|
||||
|
||||
},
|
||||
target = damageable.Entity,
|
||||
damage = 64,
|
||||
hit = damageable,
|
||||
});
|
||||
var direction = (damageable.Rigidbody.position - (Vector3)command.Position).normalized;
|
||||
damageable.Rigidbody.AddForceAtPositionAsync(direction * 512 ,command.Position,ForceMode.Impulse).Forget();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (x.TryGetComponent<ITag>(out var _tag))
|
||||
{
|
||||
DI.Get<VFXService>().Spawn(new Location
|
||||
damaged.Add(damageable.Entity);
|
||||
damageable.GiveDamage(new DamageMessage()
|
||||
{
|
||||
position = x.transform.position,
|
||||
rotation = Quaternion.identity,
|
||||
forward = direction
|
||||
},_tag.GetTags());
|
||||
initiator = UnityEntitiesService.Get(command.PlayerId) as IEntity,
|
||||
damageType = new MeleeDamageMessage
|
||||
{
|
||||
|
||||
},
|
||||
target = damageable.Entity,
|
||||
damage = command.Damage is 0 ? 64 : command.Damage,
|
||||
hit = damageable,
|
||||
});
|
||||
damageable.Rigidbody.AddForceAtPositionAsync(command.Force, command.Position, ForceMode.Impulse)
|
||||
.Forget();
|
||||
|
||||
if (x.TryGetComponent<ITag>(out var _tag))
|
||||
{
|
||||
DI.Get<VFXService>().Spawn(new Location
|
||||
{
|
||||
position = x.transform.position,
|
||||
//rotation = Quaternion.identity,
|
||||
}, _tag.GetTags());
|
||||
}
|
||||
}
|
||||
catch (UnassignedReferenceException e)
|
||||
{
|
||||
Debug.LogWarning(x.name);
|
||||
Debug.LogException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user