Advertisement
Guest User

Untitled

a guest
Jul 4th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function SharedAnimation_MergeVisualization2(X2Action BuildTree, out X2Action VisualizationTree)
  2. {
  3.     local XComGameStateVisualizationMgr     VisMgr;
  4.     local array<X2Action>                   arrActions;
  5.     local X2Action_MarkerTreeInsertBegin    MarkerStart;
  6.     local X2Action_MarkerTreeInsertEnd      MarkerEnd;
  7.     local X2Action WaitAction;
  8.     local X2Action_MarkerNamed  MarkerAction;
  9.     local X2Action_ApplyWeaponDamageToUnit DamageAction;
  10.     local XComGameStateContext_Ability AbilityContext;
  11.     local VisualizationActionMetadata ActionMetadata;
  12.     local bool bFoundHistoryIndex;
  13.     local int i;
  14.  
  15.     VisMgr = `XCOMVISUALIZATIONMGR;
  16.    
  17.     MarkerStart = X2Action_MarkerTreeInsertBegin(VisMgr.GetNodeOfType(BuildTree, class'X2Action_MarkerTreeInsertBegin'));
  18.     AbilityContext = XComGameStateContext_Ability(MarkerStart.StateChangeContext);
  19.     VisMgr.GetNodesOfType(VisualizationTree, class'X2Action_Fire', arrActions);
  20.  
  21.     for (i = 0; i < arrActions.Length; i++)
  22.     {
  23.         if (arrActions[i].StateChangeContext.AssociatedState.HistoryIndex == AbilityContext.DesiredVisualizationBlockIndex)
  24.         {
  25.             bFoundHistoryIndex = true;
  26.             break;
  27.         }
  28.     }
  29.     if (bFoundHistoryIndex) `LOG("found history index!",, 'IRISINGE');
  30.     else
  31.     {
  32.         `LOG("not found history index!",, 'IRISINGE');
  33.         AbilityContext.SuperMergeIntoVisualizationTree(BuildTree, VisualizationTree);
  34.         return;
  35.     }
  36.  
  37.     AbilityContext = XComGameStateContext_Ability(arrActions[i].StateChangeContext);
  38.     ActionMetaData = arrActions[i].Metadata;
  39.     WaitAction = class'X2Action_WaitForAbilityEffect'.static.AddToVisualizationTree(ActionMetaData, AbilityContext,, arrActions[i]);
  40.  
  41.     VisMgr.ConnectAction(MarkerStart, VisualizationTree,, WaitAction);
  42.  
  43.     VisMgr.GetNodesOfType(VisualizationTree, class'X2Action_MarkerNamed', arrActions);
  44.  
  45.     for (i = 0; i < arrActions.Length; i++)
  46.     {
  47.         MarkerAction = X2Action_MarkerNamed(arrActions[i]);
  48.  
  49.         if (MarkerAction.MarkerName == 'Join' && MarkerAction.StateChangeContext.AssociatedState.HistoryIndex == AbilityContext.DesiredVisualizationBlockIndex)
  50.         {
  51.             MarkerEnd = X2Action_MarkerTreeInsertEnd(VisMgr.GetNodeOfType(BuildTree, class'X2Action_MarkerTreeInsertEnd'));
  52.  
  53.             //If the second shot has a join created, then just slot it in above the first shots join
  54.             if (MarkerEnd != none)
  55.             {
  56.                 VisMgr.ConnectAction(MarkerEnd, VisualizationTree,,, MarkerAction.ParentActions);
  57.                 VisMgr.ConnectAction(MarkerAction, BuildTree,, MarkerEnd);
  58.             }
  59.             //If the second shot does not have a join, then connect the leaf nodes to the first shots join
  60.             else
  61.             {
  62.                 VisMgr.GetAllLeafNodes(BuildTree, arrActions);
  63.                 VisMgr.ConnectActionMarkerAction, BuildTree,,, arrActions);
  64.             }
  65.             break;
  66.         }
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement