Class CharacterData
This defines a character in the game. The name Character is used in a loose sense, it just means something that can be attacked and have some stats including health. It could also be an inanimate object like a breakable box.
Inheritance
Inherited Members
Namespace: CreatorKitCode
Assembly: Assembly-CSharp.dll
Syntax
public class CharacterData : HighlightableObject
Fields
CharacterName
Declaration
public string CharacterName
Field Value
Type | Description |
---|---|
System.String |
Equipment
Declaration
public EquipmentSystem Equipment
Field Value
Type | Description |
---|---|
EquipmentSystem |
HitClip
Declaration
public AudioClip[] HitClip
Field Value
Type | Description |
---|---|
UnityEngine.AudioClip[] |
Inventory
Declaration
public InventorySystem Inventory
Field Value
Type | Description |
---|---|
InventorySystem |
StartingWeapon
The starting weapon equipped when the Character is created. Set through the Unity Editor.
Declaration
public Weapon StartingWeapon
Field Value
Type | Description |
---|---|
Weapon |
Stats
Declaration
public StatSystem Stats
Field Value
Type | Description |
---|---|
StatSystem |
Properties
CanAttack
Will return true if the attack cooldown have reached 0. False otherwise.
Declaration
public bool CanAttack { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OnDamage
Callback for when that CharacterData receive damage. E.g. used by the player character to trigger the right animation
Declaration
public Action OnDamage { get; set; }
Property Value
Type | Description |
---|---|
System.Action |
Methods
Attack(CharacterData)
Attack the given target. NOTE : this WON'T check if the target CAN be attacked, you should make sure before with the CanAttackTarget function.
Declaration
public void Attack(CharacterData target)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | target | The CharacterData you want to attack |
AttackTriggered()
This need to be called as soon as an attack is triggered, it will start the cooldown. This is separate from the actual Attack function as AttackTriggered will be called at the beginning of the animation while the Attack function (doing the actual attack and damage) will be called by an animation event to match the animation
Declaration
public void AttackTriggered()
CanAttackReach(CharacterData)
Will check if that CharacterData can reach the given target with its currently equipped weapon. Will rarely be called, as the function CanAttackTarget will call this AND also check if the cooldown is finished.
Declaration
public bool CanAttackReach(CharacterData target)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | target | The CharacterData you want to reach |
Returns
Type | Description |
---|---|
System.Boolean | True if you can reach the target, False otherwise |
CanAttackTarget(CharacterData)
Will check if the target is attackable. This in effect check :
- If the target is in range of the weapon
- If this character attack cooldown is finished
- If the target isn't already dead
Declaration
public bool CanAttackTarget(CharacterData target)
Parameters
Type | Name | Description |
---|---|---|
CharacterData | target | The CharacterData you want to reach |
Returns
Type | Description |
---|---|
System.Boolean | True if the target can be attacked, false if any of the condition isn't met |
Damage(Weapon.AttackData)
Damage the Character by the AttackData given as parameter. See the documentation for that class for how to add damage to that attackData. (this will be done automatically by weapons, but you may need to fill it manually when writing special elemental effect)
Declaration
public void Damage(Weapon.AttackData attackData)
Parameters
Type | Name | Description |
---|---|---|
Weapon.AttackData | attackData |
Death()
Call when the character die (health reach 0).
Declaration
public void Death()
Init()
Declaration
public void Init()