From cb12151465281af3507a0ead0ea8cad261f3be22 Mon Sep 17 00:00:00 2001 From: Marikuana Date: Wed, 10 Aug 2022 16:13:06 +0300 Subject: [PATCH] add OnStackCountChanged --- GameServerLib/GameObjects/Other/Stackable.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/GameServerLib/GameObjects/Other/Stackable.cs b/GameServerLib/GameObjects/Other/Stackable.cs index 2426bb55f9..fcc6b5fc80 100644 --- a/GameServerLib/GameObjects/Other/Stackable.cs +++ b/GameServerLib/GameObjects/Other/Stackable.cs @@ -6,7 +6,19 @@ namespace LeagueSandbox.GameServer.GameObjects.Other public class Stackable { public int MaxStacks { get; protected set; } - public int StackCount { get; protected set; } + public int StackCount + { + get => stackCount; protected set + { + if (stackCount != value) + { + OnStackCountChanged(stackCount, value); + stackCount = value; + } + } + } + + private int stackCount; public virtual bool IncrementStackCount() { @@ -37,5 +49,9 @@ public virtual void SetStacks(int newStacks) } StackCount = newStacks; } + + protected virtual void OnStackCountChanged(int oldStackCount, int newStackCount) + { + } } }