Changeset 965 for AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-knockdown-.oni-patch
- Timestamp:
- Mar 2, 2014, 2:50:25 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
AE/packages/31000GlassBreakingMoves/patches/common/level0_Final/TRAM-knockdown-.oni-patch
r959 r965 3 3 @CUSTOM_CODE 4 4 <code> 5 function contains(fullStringOrArray, subString){6 return fullStringOrArray.indexOf(subString)!=-1;7 }8 9 function removeFromArray(_array, _value){10 _array.splice(_array.indexOf(_value), 1);11 }12 13 5 var myBuilder = new JSXMLBuilder(); 14 6 myBuilder.load($xmlData); 15 7 16 8 var elements = myBuilder.elements[0]; 17 18 9 var particles = elements.childElement("Animation").childElement("Particles"); 19 10 20 // Check if any of the existing particles contains a head bone 21 for (var i=0; (particles.childElement(i)); i++){ // the condition is to check if the child element exists (!= undefined) 22 var currElement=particles.childElement(i); 11 // Check to see if glass_break is already added to Head 12 for (var i = 0; (particles.childElement(i)); i++) 13 { 14 var particle = particles.childElement(i); 15 if (particle.childElement("Bone").text == "Head" && 16 particle.childElement("Name").text == "glass_break") 17 return; 18 } 23 19 24 if(currElement.childElement("Bone").text=="Head"){ 25 if(currElement.childElement("Name").text=="glass_break"){ 26 return; // not necessary to add 27 } 28 else{ 29 // gather all the necessary info 30 var int_start=currElement.childElement("Start").text; 31 var int_end=currElement.childElement("End").text; 20 // Exit if we are past Oni's limit on TRAM particles 21 if (particles.length >= 16) 22 return; 32 23 33 // Insert the new glass particle (for when he touches glass with head 34 myBuilder.addElementAt("Particle","", 35 "<Start>"+int_start+"</Start>\ 36 <End>"+int_end+"</End>\ 37 <Bone>Head</Bone>\ 38 <Name>glass_break</Name>",particles.index+1,particles.level+1); 39 break; 40 } 41 } 42 } 24 // Add the glass_break particle to Head for duration of animation 25 var heights = elements.childElement("Animation").childElement("Heights"); 26 var anim_length; 27 for (anim_length = 0; (heights.childElement(anim_length)); anim_length++) {;} 28 myBuilder.addElementAt("Particle", 29 "", 30 "<Start>0</Start>\ 31 <End>" + (anim_length-1) + "</End>\ 32 <Bone>Head</Bone>\ 33 <Name>glass_break</Name>", 34 particles.index + 1, 35 particles.level + 1); 43 36 44 $xmlData=myBuilder.generateXML(); // update the global variable with the new XML 37 // Update the global variable with the new XML 38 $xmlData = myBuilder.generateXML(); 45 39 </code>
Note:
See TracChangeset
for help on using the changeset viewer.