Hi guys so this has been stumping me, so I have a card game where cards have unique abilities, now these cards are scriptable objects and some cards have unique abilities on them. Im running into an issue of how to run the ability when it needs to be triggered. I made it dynamically get the component onto the object
now i need the code to work when the condition the do is triggered but i cant explicitly hard code the name of the function in the triggering code (this is the triggering code in class "cardbehaviour)
void Attack ()
{
CardTypes cardType = card.GetComponent<CardDisplay>().eCardtype;
string cardDmg = card.transform.GetComponent<CardDisplay>().damageText.text;
switch(cardType){
case CardTypes.BASIC:
BattleManager.Targeting(int.Parse(cardDmg));
break;
case CardTypes.TECHNIQUE:
executeTechnique = true;
break;
case CardTypes.PERRY:
break;
case CardTypes.COUNTER:
break;
}
this is the class and code i want to have happen, but the update method im trying to use is making it do continuous damagae.
void Update()
{
if (this.gameObject.GetComponent<CardBehaviour>().executeTechnique == true)
{
TechniqueExecution();
}
}
public void TechniqueExecution()
{
CardForms cardForms = BattleManager.activePlayer.FormCard.GetComponent<CardDisplay>().eCardForm;
if (cardForms == this.gameObject.GetComponent<CardDisplay>().eCardForm)
{
CrecentCannon();
}
else
{
this.gameObject.GetComponent<CardBehaviour>().executeTechnique = false;
CresecntKickStandard();
}
}