1
This commit is contained in:
6
Assets/BITFALL/AI/AIMisc.cs
Normal file
6
Assets/BITFALL/AI/AIMisc.cs
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
namespace BITFALL.AI
|
||||
{
|
||||
public interface AIActionReason{}
|
||||
|
||||
}
|
134
Assets/BITFALL/AI/AIStates.cs
Normal file
134
Assets/BITFALL/AI/AIStates.cs
Normal file
@@ -0,0 +1,134 @@
|
||||
|
||||
// ReSharper disable IdentifierTypo
|
||||
|
||||
using System;
|
||||
using BITFALL.AI;
|
||||
using BITKit.StateMachine;
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace BITKit.AI.States
|
||||
{
|
||||
//基础定义
|
||||
public interface AI_Base:IState
|
||||
{
|
||||
/// <summary>
|
||||
/// 为什么进入这个状态
|
||||
/// </summary>
|
||||
AIActionReason Reason { get; }
|
||||
}
|
||||
[Serializable]
|
||||
public abstract class AIState:AI_Base
|
||||
{
|
||||
public bool Enabled { get; set; }
|
||||
public AIActionReason Reason { get; set; }
|
||||
public virtual void Initialize()
|
||||
{
|
||||
}
|
||||
public virtual void OnStateEntry(IState old)
|
||||
{
|
||||
}
|
||||
public virtual void OnStateUpdate(float deltaTime)
|
||||
{
|
||||
}
|
||||
public virtual void OnStateExit(IState old, IState newState)
|
||||
{
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 静止,无任何行为
|
||||
/// </summary>
|
||||
public interface AI_Idle:AI_Base{}
|
||||
/// <summary>
|
||||
/// 巡逻,通常是哨兵AI才会有的状态
|
||||
/// </summary>
|
||||
public interface AI_Patrol:AI_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 巡逻点
|
||||
/// </summary>
|
||||
float3[] PatrolPoints { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// AI追踪,通常为丢失目标一定时间后
|
||||
/// </summary>
|
||||
public interface AI_Track:AI_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前目标
|
||||
/// </summary>
|
||||
AITarget CurrentTarget { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// AI警戒,此时还未发现敌人
|
||||
/// </summary>
|
||||
public interface AI_Alert:AI_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前警戒级别,如果最高则进入战斗状态
|
||||
/// </summary>
|
||||
int AlertLevel { get; }
|
||||
/// <summary>
|
||||
/// 剩余警戒时间
|
||||
/// </summary>
|
||||
float RemainingAlertTime { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 战斗状态,明确的敌人
|
||||
/// </summary>
|
||||
public interface AI_Combat:AI_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 当前目标
|
||||
/// </summary>
|
||||
AITarget CurrentTarget { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 逃跑,通常是人类AI或者特殊感染者才有的状态
|
||||
/// </summary>
|
||||
public interface AI_Flee:AI_Base
|
||||
{
|
||||
float3 NextPoint { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 通常只有感染者AI才会有的状态
|
||||
/// </summary>
|
||||
public interface AI_Wander:AI_Base
|
||||
{
|
||||
/// <summary>
|
||||
/// 下一个漫步的位置
|
||||
/// </summary>
|
||||
float3 NextPoint { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 死亡,回收进AI池
|
||||
/// </summary>
|
||||
public interface AI_Death:AI_Base
|
||||
{
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// 濒死状态,如果一定时间内没有救助,则进入死亡状态
|
||||
/// </summary>
|
||||
public interface AI_Dying:AI_Base
|
||||
{
|
||||
int RemainingHealthPoint { get; }
|
||||
}
|
||||
/// <summary>
|
||||
/// 探索,通常是人类AI才会有的状态
|
||||
/// </summary>
|
||||
public interface AI_Explore:AI_Base
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// 行为,这是个口袋状态,任何特殊状态都可以放在这里
|
||||
/// </summary>
|
||||
public interface AI_Action:AI_Base
|
||||
{
|
||||
}
|
||||
/// <summary>
|
||||
/// 休息状态,通常是人类AI在睡眠或者在逃跑成功后会有的状态
|
||||
/// </summary>
|
||||
public interface AI_Rest:AI_Base
|
||||
{
|
||||
}
|
||||
}
|
11
Assets/BITFALL/AI/AITarget.cs
Normal file
11
Assets/BITFALL/AI/AITarget.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
using Unity.Mathematics;
|
||||
|
||||
namespace BITFALL.AI
|
||||
{
|
||||
public interface AITarget
|
||||
{
|
||||
float3 Position { get; }
|
||||
quaternion Rotation { get; }
|
||||
}
|
||||
}
|
18
Assets/BITFALL/AI/BITFALL.AI.asmdef
Normal file
18
Assets/BITFALL/AI/BITFALL.AI.asmdef
Normal file
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "BITFALL.AI",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:d8b63aba1907145bea998dd612889d6b",
|
||||
"GUID:f51ebe6a0ceec4240a699833d6309b23"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": true
|
||||
}
|
Reference in New Issue
Block a user