void SetupVars() { fsm = new Diagram(); context = GetComponent<ProjectileContext>(); fsm.SetContext(context); // Conditions If_HittingTarget = new If_CloserThan().SetFloat(0.2f); // If_HittingTarget.SetFloat(0.2f); // Actions Do_Follow = new Do_Follow(); Do_FaceTarget = new Do_FaceTarget(); Do_Damage = new Do_Damage(); Do_Destroy = new Do_Destroy(); }
// Initialize context void InitializeVars() { fsm = new Diagram(); context = GetComponent<InputContext>(); fsm.SetContext(context); // Conditions if_Finished = new If_ValueOf().SetInfo("finished", context); if_Clicked = new If_Clicked(); if_TargetIsCharacter = new If_TargetIsCharacter(); if_TargetIsGround = new If_TargetIsCharacter().Invert(); // Actions do_SetGroundTarget = new Do_SetGroundTarget(); do_SetCharacterTarget = new Do_SetCharacterTarget(); do_ResetInput = new Do_ResetInput(); do_ListenInput = new Do_ListenInput(); }