This commit is contained in:
parent
ff7afe4133
commit
5fceb6f885
|
@ -1,7 +1,11 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
namespace BITFALL.Bullet
|
namespace BITFALL.Bullet
|
||||||
{
|
{
|
||||||
public interface IBulletService
|
public interface IBulletService
|
||||||
{
|
{
|
||||||
|
int LayerMask { get; set; }
|
||||||
void Spawn(BulletData bulletData);
|
void Spawn(BulletData bulletData);
|
||||||
|
Func<int,int,bool> OnHit { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Cysharp.Threading.Tasks;
|
using Cysharp.Threading.Tasks;
|
||||||
|
using Unity.Mathematics;
|
||||||
|
|
||||||
namespace Net.Project.B.Damage
|
namespace Net.Project.B.Damage
|
||||||
{
|
{
|
||||||
|
@ -32,6 +33,7 @@ namespace Net.Project.B.Damage
|
||||||
public int InitialDamage { get; }
|
public int InitialDamage { get; }
|
||||||
public int FinalDamage { get; }
|
public int FinalDamage { get; }
|
||||||
public bool IsFatal { get; }
|
public bool IsFatal { get; }
|
||||||
|
public float3 ContactPosition { get; }
|
||||||
public IDamageType DamageType { get; }
|
public IDamageType DamageType { get; }
|
||||||
IReadOnlyCollection<IDamageData> Reports { get; }
|
IReadOnlyCollection<IDamageData> Reports { get; }
|
||||||
}
|
}
|
||||||
|
@ -40,7 +42,7 @@ namespace Net.Project.B.Damage
|
||||||
{
|
{
|
||||||
public event Func<IDamageReport, UniTask<IDamageData>> DamageFactor;
|
public event Func<IDamageReport, UniTask<IDamageData>> DamageFactor;
|
||||||
public event Action<IDamageReport> OnDamaged;
|
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;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using BITKit.WorldNode;
|
||||||
|
|
||||||
namespace Net.Project.B.Faction
|
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": [
|
"references": [
|
||||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||||
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
"GUID:f51ebe6a0ceec4240a699833d6309b23",
|
||||||
"GUID:d8b63aba1907145bea998dd612889d6b"
|
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||||
|
"GUID:d750d221812bb1d48baff92e6ef73e28"
|
||||||
],
|
],
|
||||||
"includePlatforms": [],
|
"includePlatforms": [],
|
||||||
"excludePlatforms": [],
|
"excludePlatforms": [],
|
||||||
|
|
|
@ -12,14 +12,31 @@ namespace Net.Project.B.Health
|
||||||
{
|
{
|
||||||
public interface IHealthComponent
|
public interface IHealthComponent
|
||||||
{
|
{
|
||||||
|
public int HealthPoint { get;internal set; }
|
||||||
public int MaxHealthPoint { get; }
|
public int MaxHealthPoint { get; }
|
||||||
|
public event Action<int, int> OnHealthChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class HealthComponent:IHealthComponent,IWorldNode
|
public class HealthComponent:IHealthComponent,IWorldNode
|
||||||
{
|
{
|
||||||
public int maxHealthPoint = 100;
|
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 int MaxHealthPoint => maxHealthPoint;
|
||||||
|
public event Action<int, int> OnHealthChanged;
|
||||||
}
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 生命值服务
|
/// 生命值服务
|
||||||
|
@ -66,13 +83,9 @@ namespace Net.Project.B.Health
|
||||||
|
|
||||||
private void OnAdd(IEntity obj)
|
private void OnAdd(IEntity obj)
|
||||||
{
|
{
|
||||||
if (obj.ServiceProvider.GetService<IHealthComponent>() is {} healthComponent)
|
if (obj.ServiceProvider.QueryComponents(out IHealthComponent healthComponent) is false) return;
|
||||||
{
|
HealthComponents[obj.Id] = healthComponent;
|
||||||
if (HealthComponents.TryAdd(obj.Id, healthComponent))
|
Healths[obj.Id] = healthComponent.HealthPoint = healthComponent.MaxHealthPoint <= 0 ? 100 : healthComponent.MaxHealthPoint;
|
||||||
{
|
|
||||||
Healths.TryAdd(obj.Id, healthComponent.MaxHealthPoint <=0 ? 100 : healthComponent.MaxHealthPoint);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[BITCommand]
|
[BITCommand]
|
||||||
|
@ -87,9 +100,7 @@ namespace Net.Project.B.Health
|
||||||
{
|
{
|
||||||
Healths.GetOrAdd(id,100);
|
Healths.GetOrAdd(id,100);
|
||||||
_singleton.AddHealth(id, newHealth, null).Forget();
|
_singleton.AddHealth(id, newHealth, null).Forget();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IReadOnlyDictionary<int, int> IHealthService.Healths => Healths;
|
IReadOnlyDictionary<int, int> IHealthService.Healths => Healths;
|
||||||
private static event Func<int,int,int,object,int> OnHealthChange;
|
private static event Func<int,int,int,object,int> OnHealthChange;
|
||||||
|
@ -115,7 +126,7 @@ namespace Net.Project.B.Health
|
||||||
value =func.Invoke(id,current, value, arg);
|
value =func.Invoke(id,current, value, arg);
|
||||||
}
|
}
|
||||||
var newHp = Math.Clamp(current + value, -1, HealthComponents[id].MaxHealthPoint);
|
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);
|
OnHealthChanged?.Invoke(id,current,newHp,arg);
|
||||||
return UniTask.FromResult(newHp);
|
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>
|
/// </summary>
|
||||||
public T InspectKey { get; }
|
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 IUXSnapshot:IUXPanel{}
|
||||||
public interface IUXInventorySwap:IUXPanel{}
|
public interface IUXInventorySwap:IUXPanel{}
|
||||||
public interface IUXMap: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 class UnityDoorNode:IWorldNode
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
public object WorldObject { get; set; }
|
|
||||||
public UnityDoorState State;
|
public UnityDoorState State;
|
||||||
public WorldInteractionProcess InteractionType;
|
public WorldInteractionProcess InteractionType;
|
||||||
public bool IsDoubleSwing;
|
public bool IsDoubleSwing;
|
||||||
|
|
|
@ -26,6 +26,8 @@ namespace Net.Project.B.WorldNode
|
||||||
public Transform steeringWheel;
|
public Transform steeringWheel;
|
||||||
|
|
||||||
public bool allowAckermannSteering;
|
public bool allowAckermannSteering;
|
||||||
|
|
||||||
|
public float steeringWheelAngle=180;
|
||||||
|
|
||||||
public float maxForwardSpeed = 100f; // 100f default
|
public float maxForwardSpeed = 100f; // 100f default
|
||||||
public float maxReverseSpeed = 30f; // 30f default
|
public float maxReverseSpeed = 30f; // 30f default
|
||||||
|
|
Loading…
Reference in New Issue