This commit is contained in:
parent
ff7afe4133
commit
5fceb6f885
|
@ -1,7 +1,11 @@
|
|||
using System;
|
||||
|
||||
namespace BITFALL.Bullet
|
||||
{
|
||||
public interface IBulletService
|
||||
{
|
||||
int LayerMask { get; set; }
|
||||
void Spawn(BulletData bulletData);
|
||||
Func<int,int,bool> OnHit { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace Net.Project.B.Damage
|
||||
{
|
||||
|
@ -32,6 +33,7 @@ namespace Net.Project.B.Damage
|
|||
public int InitialDamage { get; }
|
||||
public int FinalDamage { get; }
|
||||
public bool IsFatal { get; }
|
||||
public float3 ContactPosition { get; }
|
||||
public IDamageType DamageType { get; }
|
||||
IReadOnlyCollection<IDamageData> Reports { get; }
|
||||
}
|
||||
|
@ -40,7 +42,7 @@ namespace Net.Project.B.Damage
|
|||
{
|
||||
public event Func<IDamageReport, UniTask<IDamageData>> DamageFactor;
|
||||
public event Action<IDamageReport> OnDamaged;
|
||||
public UniTask<IDamageReport> CreateDamageAsync(int initiator, int target, int initialDamage, IDamageType damageType);
|
||||
public UniTask<IDamageReport> CreateDamageAsync(int initiator, int target, int initialDamage, IDamageType damageType,float3 contact);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,11 +1,38 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.WorldNode;
|
||||
|
||||
namespace Net.Project.B.Faction
|
||||
{
|
||||
public enum FactionTypes
|
||||
public interface IFactionType:IWorldNode{
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Human:IFactionType{}
|
||||
|
||||
[Serializable]
|
||||
public class Player:Human
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Zombie:IFactionType
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Bandit:Human
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class Survivor:Human
|
||||
{
|
||||
|
||||
}
|
||||
}
|
|
@ -4,7 +4,8 @@
|
|||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b"
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||
"GUID:d750d221812bb1d48baff92e6ef73e28"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
|
|
|
@ -12,14 +12,31 @@ namespace Net.Project.B.Health
|
|||
{
|
||||
public interface IHealthComponent
|
||||
{
|
||||
public int HealthPoint { get;internal set; }
|
||||
public int MaxHealthPoint { get; }
|
||||
public event Action<int, int> OnHealthChanged;
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
public class HealthComponent:IHealthComponent,IWorldNode
|
||||
{
|
||||
public int maxHealthPoint = 100;
|
||||
public int healthPoint;
|
||||
|
||||
int IHealthComponent.HealthPoint
|
||||
{
|
||||
get => healthPoint;
|
||||
set
|
||||
{
|
||||
var prevHp = healthPoint;
|
||||
if(prevHp==value)return;
|
||||
healthPoint = value;
|
||||
OnHealthChanged?.Invoke(prevHp,healthPoint);
|
||||
}
|
||||
}
|
||||
|
||||
public int MaxHealthPoint => maxHealthPoint;
|
||||
public event Action<int, int> OnHealthChanged;
|
||||
}
|
||||
/// <summary>
|
||||
/// 生命值服务
|
||||
|
@ -66,13 +83,9 @@ namespace Net.Project.B.Health
|
|||
|
||||
private void OnAdd(IEntity obj)
|
||||
{
|
||||
if (obj.ServiceProvider.GetService<IHealthComponent>() is {} healthComponent)
|
||||
{
|
||||
if (HealthComponents.TryAdd(obj.Id, healthComponent))
|
||||
{
|
||||
Healths.TryAdd(obj.Id, healthComponent.MaxHealthPoint <=0 ? 100 : healthComponent.MaxHealthPoint);
|
||||
}
|
||||
}
|
||||
if (obj.ServiceProvider.QueryComponents(out IHealthComponent healthComponent) is false) return;
|
||||
HealthComponents[obj.Id] = healthComponent;
|
||||
Healths[obj.Id] = healthComponent.HealthPoint = healthComponent.MaxHealthPoint <= 0 ? 100 : healthComponent.MaxHealthPoint;
|
||||
}
|
||||
|
||||
[BITCommand]
|
||||
|
@ -87,10 +100,8 @@ namespace Net.Project.B.Health
|
|||
{
|
||||
Healths.GetOrAdd(id,100);
|
||||
_singleton.AddHealth(id, newHealth, null).Forget();
|
||||
|
||||
}
|
||||
|
||||
|
||||
IReadOnlyDictionary<int, int> IHealthService.Healths => Healths;
|
||||
private static event Func<int,int,int,object,int> OnHealthChange;
|
||||
private static event Action<int,int,int,object> OnHealthChanged;
|
||||
|
@ -115,7 +126,7 @@ namespace Net.Project.B.Health
|
|||
value =func.Invoke(id,current, value, arg);
|
||||
}
|
||||
var newHp = Math.Clamp(current + value, -1, HealthComponents[id].MaxHealthPoint);
|
||||
Healths.Set(id,newHp);
|
||||
Healths.Set(id,HealthComponents[id].HealthPoint = newHp);
|
||||
OnHealthChanged?.Invoke(id,current,newHp,arg);
|
||||
return UniTask.FromResult(newHp);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 9e3dbc7386e49c54b94b8c96431f4d46
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using BITKit.WorldNode;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace Net.Project.B.Mark
|
||||
{
|
||||
public interface IMarkType{}
|
||||
public interface IMarkComponent
|
||||
{
|
||||
public float3 Position { get; }
|
||||
public IMarkType MarkType { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: af35735b7dd800949af5b77101747c68
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,15 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Net.Project.B.Mark
|
||||
{
|
||||
public interface IMarkService
|
||||
{
|
||||
void Mark(int id);
|
||||
void CancelMark(int id);
|
||||
public event Action<int, bool> OnMark;
|
||||
IReadOnlyCollection<int> InMarking { get; }
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: ef2352c99ad2cc54f812c176edd6d0ec
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -0,0 +1,18 @@
|
|||
{
|
||||
"name": "Net.Project.B.Mark",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:d750d221812bb1d48baff92e6ef73e28"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 154bc389e50c7da499c9b0c8d3a1a1b8
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
|
@ -91,6 +91,10 @@ namespace Project.B.Player
|
|||
/// 检视
|
||||
/// </summary>
|
||||
public T InspectKey { get; }
|
||||
/// <summary>
|
||||
/// 标记
|
||||
/// </summary>
|
||||
public T MarkKey { get; }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -44,4 +44,6 @@ namespace Net.Project.B.UX
|
|||
public interface IUXSnapshot:IUXPanel{}
|
||||
public interface IUXInventorySwap:IUXPanel{}
|
||||
public interface IUXMap:IUXPanel{}
|
||||
public interface IUXIndicator:IUXPanel{}
|
||||
public interface IUXMark:IUXPanel{}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ namespace Net.Project.B.WorldNode
|
|||
public class UnityDoorNode:IWorldNode
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public object WorldObject { get; set; }
|
||||
public UnityDoorState State;
|
||||
public WorldInteractionProcess InteractionType;
|
||||
public bool IsDoubleSwing;
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace Net.Project.B.WorldNode
|
|||
|
||||
public bool allowAckermannSteering;
|
||||
|
||||
public float steeringWheelAngle=180;
|
||||
|
||||
public float maxForwardSpeed = 100f; // 100f default
|
||||
public float maxReverseSpeed = 30f; // 30f default
|
||||
public float horsePower = 1000f; // 100f0 default
|
||||
|
|
Loading…
Reference in New Issue