60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
class PotionEffectsManager : ItemEffectsManager
|
|
{
|
|
public static new PotionEffectsManager Instance;
|
|
|
|
public override void Awake()
|
|
{
|
|
if (Instance == null)
|
|
{
|
|
Instance = this;
|
|
}
|
|
else
|
|
{
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
|
|
public override void UseItemEffect(ItemSlot itemSlot, PanelTypeEnum originPanel)
|
|
{
|
|
// origin panel is passed for script to be able to recognize from witch list remove object etc...
|
|
DetectPotionType();
|
|
|
|
// use other actions binded to item 2
|
|
itemSlot.Item?.InvokeEffectAction();
|
|
|
|
// remove potion from slot in specific panel...
|
|
var panelUiManager = DetectOriginPanel(originPanel);
|
|
panelUiManager.RemoveByPosition(itemSlot.Number);
|
|
panelUiManager.UpdateList(); // refresh view
|
|
}
|
|
|
|
public void DetectPotionType()
|
|
{
|
|
// detect potion and use mached action
|
|
|
|
// if( ... )
|
|
// Health....Potion();
|
|
}
|
|
|
|
// use below function in one above - depending on the condition
|
|
public void HealthBigPotion()
|
|
{
|
|
|
|
}
|
|
|
|
public void HealthSmallPotion()
|
|
{
|
|
|
|
}
|
|
|
|
|
|
// Add and invoke you own functions
|
|
}
|