You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Plugins/Animancer/Examples/09 Animator Controllers/02 3D Game Kit/Creatures/CreatureBrain.cs

48 lines
1.7 KiB
C#

3 months ago
// Animancer // Copyright 2020 Kybernetik //
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value.
using UnityEngine;
namespace Animancer.Examples.AnimatorControllers.GameKit
{
/// <summary>
/// Base class for controlling the actions of a <see cref="Brains.Creature"/>.
/// </summary>
[AddComponentMenu(Strings.MenuPrefix + "Examples/Game Kit - Creature Brain")]
[HelpURL(Strings.APIDocumentationURL + ".Examples.AnimatorControllers.GameKit/CreatureBrain")]
public abstract class CreatureBrain : MonoBehaviour
{
/************************************************************************************************************************/
[SerializeField]
private Creature _Creature;
public Creature Creature
{
get { return _Creature; }
set
{
if (_Creature == value)
return;
var oldCreature = _Creature;
_Creature = value;
// Make sure the old creature doesn't still reference this brain.
if (oldCreature != null)
oldCreature.Brain = null;
// Give the new creature a reference to this brain.
if (value != null)
value.Brain = this;
}
}
/************************************************************************************************************************/
public Vector3 Movement { get; protected set; }
/************************************************************************************************************************/
}
}