MCPcopy
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / getTargetOfStyle

Function getTargetOfStyle

assets/js/block_ninja.js:897–922  ·  view source on GitHub ↗
(color, wireframe)

Source from the content-addressed store, hash-verified

895 ];
896
897 function getTargetOfStyle(color, wireframe) {
898 const pool = wireframe ? targetWireframePool : targetPool;
899 let target = pool.get(color).pop();
900 if (!target) {
901 target = new Entity({
902 model: optimizeModel(makeRecursiveCubeModel({
903 recursionLevel: 1,
904 splitFn: mengerSpongeSplit,
905 scale: targetRadius
906 })),
907 color: color,
908 wireframe: wireframe
909 });
910
911 // Init any properties that will be used.
912 // These will not be automatically reset when recycled.
913 target.color = color;
914 target.wireframe = wireframe;
915 // Some properties don't have their final value yet.
916 // Initialize with any value of the right type.
917 target.hit = false;
918 target.maxHealth = 0;
919 target.health = 0;
920 }
921 return target;
922 }
923
924 return function getTarget() {
925 if (doubleStrong && state.game.score <= doubleStrongEnableScore) {

Callers 1

block_ninja.jsFile · 0.85

Calls 2

optimizeModelFunction · 0.85
makeRecursiveCubeModelFunction · 0.85

Tested by

no test coverage detected