Implement health modification on enemy kill; add HealOnKillModifier and update death behavior
This commit is contained in:
25
Assets/Scripts/Modifiers/HealOnKillModifier.cs
Normal file
25
Assets/Scripts/Modifiers/HealOnKillModifier.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using Data;
|
||||
using Interfaces;
|
||||
using Systems;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Modifiers
|
||||
{
|
||||
[Serializable]
|
||||
public class HealOnKillModifier : IStatModifier, IOnKillEffect
|
||||
{
|
||||
public float value;
|
||||
public string Description => $"+{value} Health on Kill";
|
||||
|
||||
public void Apply(CharacterAttributes attributes) { }
|
||||
|
||||
public void Remove(CharacterAttributes attributes) { }
|
||||
|
||||
public void OnKill(GameObject killer, GameObject victim)
|
||||
{
|
||||
killer.TryGetComponent(out Character character);
|
||||
character?.attributes.ModifyHealth(value);
|
||||
}
|
||||
}
|
||||
}
|
3
Assets/Scripts/Modifiers/HealOnKillModifier.cs.meta
Normal file
3
Assets/Scripts/Modifiers/HealOnKillModifier.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b329a84895234a3290156c5afe257212
|
||||
timeCreated: 1752314314
|
Reference in New Issue
Block a user