// Check to see if an integer meets certain conditions in an if statement // This is used by both If and Else If public int Execute(HeroKitObject hko) { // assign variables heroKitObject = hko; eventID = heroKitObject.heroStateData.eventBlock; int actionID = heroKitObject.heroStateData.action; int currentIndent = heroKitObject.heroState.heroEvent[eventID].actions[actionID].indent; // evaluate the if statement int comparison = DropDownListValue.GetValue(heroKitObject, 2); float value1 = FloatFieldValue.GetValueB(heroKitObject, 1); float value2 = FloatFieldValue.GetValueA(heroKitObject, 3); bool evaluation = HeroActionCommonRuntime.CompareFloats(comparison, value1, value2); // next we need to get the action that we want the game loop to think just executed // this checks to see if the if statement should be run // if it should run, it disables the next conditional action if it is "Else" or "Else If" int thisAction = HeroActionCommonRuntime.RunConditionalIfAction(heroKitObject, eventID, actionID, currentIndent, evaluation); // debug message if (heroKitObject.debugHeroObject) { string debugMessage = "Float A: " + value1 + "\n" + "Float B: " + value2 + "\n" + "Result: " + evaluation; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } // return the action that we want the game loop to think just executed return(thisAction); }
// Execute the action public int Execute(HeroKitObject hko) { heroKitObject = hko; float intA = FloatFieldValue.GetValueB(heroKitObject, 0); float intB = FloatFieldValue.GetValueA(heroKitObject, 2); int operation = DropDownListValue.GetValue(heroKitObject, 1); float result = HeroActionCommonRuntime.PerformMathOnFloats(operation, intA, intB); FloatFieldValue.SetValueB(heroKitObject, 0, result); // show debug message if (heroKitObject.debugHeroObject) { string debugMessage = "A: " + intA + "\n" + "B: " + intB + "\n" + "Result (A): " + result; Debug.Log(HeroKitCommonRuntime.GetActionDebugInfo(heroKitObject, debugMessage)); } return(-99); }