I have special scripts on each unit. Anytime a Unit is selected, in my case MarkAsSelected, then a special KSpellcard menu shows up.
This menu uses AC, but has scripts that read from a Scriptable Object to change the content on the menu. The menus are unique to each character based on which one is selected. I am trying to get the three buttons on my general menu interface that stays up permanently, called InGameBattleUI, to trigger a casting animation.
public override void MarkAsSelected() //Unit is selected
{
Menu KSpellcard = PlayerMenus.GetMenuWithName("KSpellcard");//Gathering KSpellcard menu and texts/images are changing based on which character is selected
KSpellcard.TurnOn();//Menu successfully turns on/displays
MenuElement C1 = PlayerMenus.GetElementWithName("BattleInGameUI", "C1"); //Getting the C1 button in the BattleInGameUI menu and calling it C1
Menu BattleInGameUI = PlayerMenus.GetMenuWithName("BattleInGameUI");//Getting BattleInGameUI Menu
MenuButton B1 = (MenuButton)C1;//Getting C1 button and calling it B1
B1.ProcessClick(BattleInGameUI, 19, MouseState.DoubleClick);// here's where I get lost
}
It won't compile at all but here is where I think my disconnect is.
I found this online:
override void AC.MenuButton.ProcessClick | ( | AC.Menu | _menu, | | | int | _slot, | | | MouseState | _mouseState | | ) | | |
| virtual |
Performs what should happen when the element is clicked on.
Parameters
_menu | The element's parent Menu |
_slot | Ignored by this subclass |
_mouseState | The state of the mouse button |
Reimplemented from AC.MenuElement.
It says it Performs what should happen when element is clicked on but I dont understand how to use it.
I want something along the lines of
if (B1.ProcessClick(BattleInGameUI, 19, MouseState.DoubleClick) //if B1 button is pressed then..
{
animator.SetTrigger("Cast1")//trigger the cast 1 animation
//dodamage or ability here etc
}
if (B2.ProcessClick(BattleInGameUI, 20, MouseState.DoubleClick) //if B2 button is pressed then..
{
animator.SetTrigger("Cast2")//trigger the cast 1 animation
//dodamage or ability here etc
}
if (B3.ProcessClick(BattleInGameUI, 21, MouseState.DoubleClick) //if B3 button is pressed then..
{
animator.SetTrigger("Cast3")//trigger the cast 3 animation
//dodamage or ability here etc
}
Any pointers would be greatly appreciated, I feel like it comes down to me not using the .ProcessClick correctly.
Comments