EntityComponent
class SoftKitty.EntityComponent
EntityComponent is a behavior class attached to a GameObject in Unity, responsible for linking Entity data with a game entity's behavior. It manages the Entity's interactions and updates in the game world.
Properties
public string uid
The unique string ID for this entity, which connects it to its corresponding entity data.
public Entity mData
A reference to the entity's data.
public bool isPlayer
Returns whether this instance represents the player entity.
public bool Engage
Returns whether this entity is currently engaged in some action or interaction.
public EntityComponent EngagedEntity
Returns the target entity that this entity is currently engaging with.
Methods
public virtual void ApplyData
Applies entity data from the database to this instance, such as position, rotation, and scale. Developers can override this for extra data specific to their needs.
public virtual void UpdateData()
Updates the entity data to the database, including position, rotation, and scale. Developers can override this for extra data updates.
public void SetEulerAngles(Vector3 _angle, bool _worldSpace = true)
Sets the Euler angles of the entity immediately.
public void SetScale(Vector3 _scale)
Sets the scale of the entity immediately.
public void Move(Vector3 _positionOffset, float _duration, bool _worldSpace, bool _stickToGround = true)
Moves the entity over a specified duration, optionally sticking to the ground.
public void Rotate(Vector3 _angleOffset, float _duration, bool _worldSpace)
Rotates the entity over a specified duration.
public void Scale(Vector3 _scale, float _duration)
Scales the entity over a specified duration. Convenient Methods (Similar to Entity Data Class):
public bool hasMatchingTag(string _filter)
Returns whether the entity has a matching tag with the provided tag string.
public bool hasMatchingTag(List<string> _filters)
Returns whether the entity has a matching tag from the provided list of tag strings.
public void RegisterAttributeChangeCallback(AttributeChangeEvent _callback)
Registers a callback for changes to the entity's attributes.
public void UnRegisterAttributeChangeCallback(AttributeChangeEvent _callback)
Unregisters a previously registered attribute change callback.
public void ClearAttributeChangeCallback()
Clears all registered attribute change callbacks.
public void RegisterEntityEventCallback(EntityEvent _callback)
Registers a callback for entity events.
public void UnRegisterEntityEventCallback(EntityEvent _callback)
Unregisters a previously registered entity event callback.
public void ClearEntityEventCallback()
Clears all registered entity event callbacks.
public void RegisterOverTimeChangeCallback(OverTimeEffectChangeEvent _callback)
Registers a callback for over-time effect changes on this entity.
public void UnRegisterOverTimeChangeCallback(OverTimeEffectChangeEvent _callback)
Unregisters a previously registered over-time effect change callback.
public void ClearOverTimeChangeCallback()
Clears all registered over-time effect change callbacks.
public Vector3 Position
The position of the entity in world space.
public Vector3 Forward
The forward direction of the entity.
public Vector3 LocalScale
The local scale of the entity.
public void SetPosition(Vector3 _pos, bool _stickToGround = true)
Sets the entity's position in world space. If _stickToGround is true, it will adjust the Y-axis to match the ground height.
public float GetCustomFloat(string _uid)
Retrieves a custom float value for the entity by its unique UID.
public int GetCustomInt(string _uid)
Retrieves a custom integer value for the entity by its unique UID.
public bool GetCustomBool(string _uid)
Retrieves a custom boolean value for the entity by its unique UID.
public string GetCustomString(string _uid)
Retrieves a custom string value for the entity by its unique UID.
public IntList GetCustomIntList(string _uid)
Retrieves a custom integer list for the entity by its unique UID.
public IdIntList GetCustomIdIntList(string _uid)
Retrieves a custom ID-to-integer list for the entity by its unique UID.
public IdFloatList GetCustomIdFloatList(string _uid)
Retrieves a custom ID-to-float list for the entity by its unique UID.
public void SetCustomFloat(string _uid, float _value)
Overrides the custom float value for the entity by its unique UID.
public void SetCustomInt(string _uid, int _value)
Overrides the custom integer value for the entity by its unique UID.
public void SetCustomBool(string _uid, bool _value)
Overrides the custom boolean value for the entity by its unique UID.
public void SetCustomString(string _uid, string _value)
Overrides the custom string value for the entity by its unique UID.
public Attribute GetAttribute(string _uid)
Retrieves the attribute associated with the entity by its unique UID.
public AttributeData GetAttributeData(string _uid)
Retrieves the attribute data associated with the entity by its unique UID.
public float GetAttributeFloat(string _uid)
Retrieves the float value of an attribute by its unique UID.
public string GetAttributeString(string _uid)
Retrieves the string value of an attribute by its unique UID.
public int GetAttributeInt(string _uid)
Retrieves the integer value of an attribute by its unique UID.
public void SetAttributeValue(string _uid, float _value, Entity _dealer = null)
Sets the value of an attribute by its unique UID (float).
public void SetAttributeValue(string _uid, string _value)
Sets the value of an attribute by its unique UID (string).
public void SetAttributeValue(string _uid, int _value, Entity _dealer = null)
Sets the value of an attribute by its unique UID (integer).
public void SetAttributeValue(int _id, float _value, Entity _dealer = null)
Sets the value of an attribute by its integer ID (float).
public void SetAttributeValue(int _id, string _value)
Sets the value of an attribute by its integer ID (string).
public void SetAttributeValue(int _id, int _value, Entity _dealer = null)
Sets the value of an attribute by its integer ID (integer).
public float AddAttributeValue(string _uid, float _value, Entity _dealer = null)
Adds a float value to an existing attribute by its unique UID and returns the result.
public int AddAttributeValue(string _uid, int _value, Entity _dealer = null)
Adds an integer value to an existing attribute by its unique UID and returns the result.
public float AddAttributeValue(int _id, float _value, Entity _dealer = null)
Adds a float value to an existing attribute by its integer ID and returns the result.
public int AddAttributeValue(int _id, int _value, Entity _dealer = null)
Adds an integer value to an existing attribute by its integer ID and returns the result.
public float AddAttributeValueClamp(string _uid, float _value, float _min, float _max, Entity _dealer = null)
Adds a float value to an existing attribute by its unique UID, clamps the result, and returns the updated value.
public int AddAttributeValueClamp(string _uid, int _value, int _min, int _max, Entity _dealer = null)
Same as above, but with integer values.
public float AddAttributeValueClamp(int _id, float _value, float _min, float _max, Entity _dealer = null)
Same as above, but with integer ID.
public int AddAttributeValueClamp(int _id, int _value, int _min, int _max, Entity _dealer = null)
Same as above, but with integer values.
public bool AvailableForInteraction
Returns whether the entity is available for interaction.
Master Inventory Engine Methods
public InventoryEngine.InventoryData GetAnyInventoryData()
Retrieve any exitsing InventoryData of this entity when available.
public InventoryEngine.InventoryData GetEquipment()
Retrieve any exitsing Equipment type InventoryData of this entity when available.
public InventoryEngine.InventoryData GetInventory()
Retrieve any exitsing Inventory|Crate type InventoryData of this entity when available.
public InventoryEngine.InventoryData GetInventoryDataByType(InventoryEngine.InventoryData.HolderType _type)
Retrieve specified type InventoryData of this entity when available.