1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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<StatusEffectsController>();
- 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;
- }
- }
- }
|