using System.Collections; using System.Collections.Generic; using UnityEngine; using KairoEngine.Core; using KairoEngine.Inventory; using KairoEngine.Stats; namespace KairoEngine.CharacterSystem { // Todo: Fix status effect controller link public class UseInstantEffectItemAction : IAction { ItemContainer itemContainer; // Reference to the character that will move ItemRef itemRef; public UseInstantEffectItemAction(ItemContainer itemContainer, ItemRef itemRef) { this.itemContainer = itemContainer; this.itemRef = itemRef; } public void Start() { ItemBaseInstantEffect item = (ItemBaseInstantEffect)itemRef.item; StatusEffectsController statusEffectsController = itemContainer.GetComponent(); if(statusEffectsController == null) { Debug.LogError("Missing StatusEffectsController in " + itemContainer.gameObject.name); return; } // ! Fix: Change status effect controller //statusEffectsController.Add(item.statusEffect); Debug.LogError("Missing Status Effect Controller"); itemRef.quantity -= 1; itemRef.lastUsed = 0f; if(itemRef.quantity <= 0) { itemContainer.RemoveItem(itemRef); } else { itemContainer.UpdateItem(itemRef); } } public void Update() { } public void End() { } public bool IsDone() { return true; } } }