This commit is contained in:
CortexCore
2023-10-30 01:25:53 +08:00
parent add6d0cab3
commit 18f664a545
125 changed files with 3529 additions and 700 deletions

View File

@@ -5,7 +5,6 @@ using System.Text;
using BITFALL.Bullet;
using UnityEngine;
using BITKit;
using BITKit.Core.Entites;
using BITKit.Entities;
using Cysharp.Threading.Tasks;
using UnityEditor;
@@ -121,15 +120,23 @@ namespace BITFALL
var force = (raycastHit.point - (Vector3)bullet.pos).normalized * (physicsInfo?.AddForceMultiple ?? 64);
if (raycastHit.collider.TryGetComponent<IDamagable>(out var damagable))
{
if (damagable.Entity.Id == bullet.initiator) return false;
if (damagable.UnityEntity?.Id == bullet.initiator) return false;
if (layerMask.Includes(raycastHit.collider.gameObject.layer) is false) return false;
var msg = new DamageMessage()
{
Target = damagable.Entity,
Target = damagable.UnityEntity,
Hit = damagable,
Damage = bullet.initialDamage,
};
damageService.Execute(msg);
if (damagable is IEntityComponent)
{
damageService.Execute(msg);
}
else
{
damagable.GiveDamage(msg);
}
}
var _rigidbody = (raycastHit.rigidbody,damagable?.Rigidbody) switch