2
0
Fork 0
mirror of https://github.com/GTA-ASM/SanAndreasUnity synced 2025-03-02 22:27:18 +00:00
SanAndreasUnity/Assets/Scripts/Behaviours/PedAI/BaseState.cs
2021-09-26 20:02:17 +02:00

80 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using SanAndreasUnity.Behaviours.Vehicles;
using SanAndreasUnity.Utilities;
namespace SanAndreasUnity.Behaviours.Peds.AI
{
/// <summary>
/// Base class for all ped AI states.
/// </summary>
public abstract class BaseState : IState
{
protected PedAI _pedAI { get; private set; }
protected Ped _ped => _pedAI.MyPed;
protected Ped MyPed => _pedAI.MyPed;
protected List<Ped> _enemyPeds => _pedAI.EnemyPeds;
public object ParameterForEnteringState { get; set; }
protected internal virtual void OnAwake(PedAI pedAI)
{
_pedAI = pedAI;
}
public virtual void OnBecameActive()
{
}
public virtual void OnBecameInactive()
{
}
public bool RepresentsState(Type type)
{
throw new NotSupportedException();
}
public bool RepresentsState<T>() where T : IState
{
throw new NotSupportedException();
}
public virtual void UpdateState()
{
}
public virtual void LateUpdateState()
{
}
public virtual void FixedUpdateState()
{
}
protected internal virtual void OnMyPedDamaged(DamageInfo dmgInfo, Ped.DamageResult dmgResult)
{
Ped attackerPed = dmgInfo.GetAttackerPed();
if (attackerPed != null)
_enemyPeds.AddIfNotPresent(attackerPed);
}
protected internal virtual void OnOtherPedDamaged(Ped damagedPed, DamageInfo dmgInfo, Ped.DamageResult dmgResult)
{
}
protected internal virtual void OnVehicleDamaged(Vehicle vehicle, DamageInfo damageInfo)
{
}
protected internal virtual void OnRecruit(Ped recruiterPed)
{
}
protected internal virtual void OnDrawGizmosSelected()
{
}
}
}