AI/Agents/Agent.cs
using System.Text.Json.Serialization;
namespace HC3;
public abstract partial class Agent : Component
{
/// <summary>
/// Controls the movement of the agent
/// </summary>
public AgentController Controller { get; set; }
/// <summary>
/// Controls actions (AI)
/// </summary>
public AgentActionController ActionController { get; set; }
/// <summary>
/// Agents can belong to a building
/// </summary>
[Property, JsonIgnore, ReadOnly]
public Building Building { get; set; }
/// <summary>
/// Inner thoughts
/// </summary>
[RequireComponent]
public AgentThoughtLog Thoughts { get; set; }
/// <summary>
/// The name of this person.
/// </summary>
[Property, Feature( "Identity" ), Group( "Identity" )]
public string FullName { get; set; }
protected override void OnEnabled()
{
Controller = GetComponentInChildren<AgentController>( true );
ActionController = GetComponentInChildren<AgentActionController>( true );
}
[Rpc.Broadcast]
public void AddTagNetworked( string tag )
{
Tags.Add( tag );
}
[Rpc.Broadcast]
public void RemoveTagNetworked( string tag )
{
Tags.Remove( tag );
}
/// <summary>
/// Called each frame by AgentTickSystem.
/// </summary>
public virtual void Tick() { }
/// <summary>
/// Called each fixed update by AgentTickSystem.
/// </summary>
public virtual void FixedTick() { }
}