private void OnTriggerEnter(Collider coll) { Debug.Log(coll.tag); if (coll.tag.Equals("Enemy")) { CreatorKitCode.CharacterData target = coll.GetComponent <CreatorKitCode.CharacterData>(); CreatorKitCode.Weapon.AttackData daño = new CreatorKitCode.Weapon.AttackData(target); daño.AddDamage(CreatorKitCode.StatSystem.DamageType.Electric, 2); target.Damage(daño); Destroy(gameObject); } }
//called after all weapon effect where applied, allow to react to the total amount of damage applied public virtual void OnPostAttack(CharacterData target, CharacterData user, AttackData data) { }
/// <summary> /// Build a new AttackData. All AttackData need a target, but source is optional. If source is null, the /// damage is assume to be from a non CharacterData source (elemental effect, environment) and no boost will /// be applied to damage (target defense is still taken in account). /// </summary> /// <param name="target"></param> /// <param name="source"></param> public AttackData(CharacterData target, CharacterData source = null) { m_Target = target; m_Source = source; }
/// <summary> /// 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. /// </summary> /// <param name="target">The CharacterData you want to reach</param> /// <returns>True if you can reach the target, False otherwise</returns> public bool CanAttackReach(CharacterData target) { return(Equipment.Weapon.CanHit(this, target)); }
//return the amount of physical damage. If no change, just return physicalDamage passed as parameter public virtual void OnAttack(CharacterData target, CharacterData user, ref AttackData data) { }
public abstract void InteractWith(CharacterData target);
/// <summary> /// Attack the given target. NOTE : this WON'T check if the target CAN be attacked, you should make sure before /// with the CanAttackTarget function. /// </summary> /// <param name="target">The CharacterData you want to attack</param> public void Attack(CharacterData target) { Equipment.Weapon.Attack(this, target); }
public void Init(CharacterData owner) { m_Owner = owner; }
public void InitWeapon(Weapon wep, CharacterData data) { m_DefaultWeapon = wep; }
public virtual void Applied(CharacterData target) { m_Timer = m_Duration; m_Target = target; }
/// <summary> /// Called by the inventory system when the object is "used" (double clicked) /// </summary> /// <param name="user">The CharacterDate that used that item</param> /// <returns>If it was actually used (allow the inventory to know if it can remove the object or not)</returns> public virtual bool UsedBy(CharacterData user) { return(false); }
public override void InteractWith(CharacterData target) { m_LootSpawner.SpawnLoot(); Destroy(this); }
public void Init(CharacterData owner) { stats.Copy(baseStats); CurrentHealth = stats.health; m_Owner = owner; }
//return true if could be used, false otherwise. public abstract bool Use(CharacterData user);
public abstract void Removed(CharacterData user);
//return true if could be used, false otherwise. public abstract void Equipped(CharacterData user);