- waypoints are created between docked subs and removed when they undock - fixed start waypoint being left out of steering paths - NPCs won't close doors/hatches on themselves - NPCs won't let go of ladders until their feet are above the lower edge of the hull - fixed FindDivingGear "loops": need to find a suit -> need to get to a suit -> need a suit to get to the suit -> need to find a suit... - fixed characters constantly turning from side to side in small rooms - recursive function for finding the button which opens a door (so a button doesn't have to be connected straight to a door for an NPC to be able to open it) - AIObjectiveGetItem keeps searching for more suitable items even if a path to a matching item has been found
71 lines
1.7 KiB
C#
71 lines
1.7 KiB
C#
using Lidgren.Network;
|
|
using Microsoft.Xna.Framework;
|
|
using Microsoft.Xna.Framework.Graphics;
|
|
|
|
namespace Barotrauma
|
|
{
|
|
class AIController : ISteerable
|
|
{
|
|
|
|
public enum AiState { None, Attack, GoTo, Escape }
|
|
public enum SteeringState { Wander, Seek, Escape }
|
|
|
|
public readonly Character Character;
|
|
|
|
protected AiState state;
|
|
|
|
protected SteeringManager steeringManager;
|
|
|
|
public SteeringManager SteeringManager
|
|
{
|
|
get { return steeringManager; }
|
|
}
|
|
|
|
public Vector2 Steering
|
|
{
|
|
get { return Character.AnimController.TargetMovement; }
|
|
set { Character.AnimController.TargetMovement = value; }
|
|
}
|
|
|
|
public Vector2 SimPosition
|
|
{
|
|
get { return Character.SimPosition; }
|
|
}
|
|
|
|
public Vector2 WorldPosition
|
|
{
|
|
get { return Character.WorldPosition; }
|
|
}
|
|
|
|
public Vector2 Velocity
|
|
{
|
|
get { return Character.AnimController.RefLimb.LinearVelocity; }
|
|
}
|
|
|
|
public AiState State
|
|
{
|
|
get { return state; }
|
|
set { state = value; }
|
|
}
|
|
|
|
public AIController (Character c)
|
|
{
|
|
Character = c;
|
|
}
|
|
|
|
public virtual void DebugDraw(SpriteBatch spriteBatch) { }
|
|
|
|
public virtual void OnAttacked(IDamageable attacker, float amount) { }
|
|
|
|
public virtual void SelectTarget(AITarget target) { }
|
|
|
|
public virtual void Update(float deltaTime) { }
|
|
|
|
//protected Structure lastStructurePicked;
|
|
|
|
public virtual void FillNetworkData(NetBuffer message) { }
|
|
public virtual void ReadNetworkData(NetIncomingMessage message) { }
|
|
|
|
}
|
|
}
|