public static IEnumerator TestSave() { TestHarness.OnSOF(() => { TestHarness.RunBehaviorScript("Save", "mokou"); var h = new ReflectEx.Hoist <float>("pqw"); var h2 = new ReflectEx.Hoist <float>("pqw2"); AreEqual(17, h2.Retrieve(3)); VecEq(Vector2.up, BM.TPool("sun-red/w")[0].bpi.loc); TestHarness.Check(0, () => { for (int ii = 0; ii < 10; ++ii) { AreEqual(ii + 10, h.Retrieve(ii)); } }); TestHarness.Check(4, () => { for (int ii = 0; ii < 10; ++ii) { AreEqual(ii + 50, h.Retrieve(ii)); } }); }); while (TestHarness.Running) { yield return(null); } }
/// <summary> /// `crosshair`: Create a crosshair that follows the target for a limited amount of time /// and saves the target's position in public data hoisting. /// </summary> public static TaskPattern Crosshair(string style, GCXF <Vector2> locator, GCXF <float> homeSec, GCXF <float> stickSec, ReflectEx.Hoist <Vector2> locSave, ExBPY indexer) { var cindexer = GCXF(indexer); var saver = Async("_$CROSSHAIR_INVALID", _ => V2RV2.Zero, AsyncPatterns.GCRepeat2( x => 1, x => ETime.ENGINEFPS * homeSec(x), GCXFRepo.RV2Zero, new[] { GenCtxProperty.SaveV2((locSave, cindexer, locator)) }, new[] { AtomicPatterns.Noop() }
/// <summary> /// Empty-guided fire that points in the same direction as the empty bullet. /// <br/>Note: when following polar bullets, you should use this. /// </summary> public static SyncPattern DS(ReflectEx.Hoist <Vector2> hoistLoc, ReflectEx.Hoist <Vector2> hoistDir, ExBPY indexer, ExTP offset) => Simple(GCXU(VTPRepo.DTPOffset(hoistLoc, hoistDir, indexer, offset)), new SBOptions(new[] { SBOption.Dir2(GCXUSB(RetrieveHoisted(hoistDir, indexer))) }));
public static Func <TExArgCtx, TEx <T> > RetrieveHoisted0 <T>(ReflectEx.Hoist <T> hoist) => tac => hoist.Retrieve(E0, tac);
public static Func <TExArgCtx, TEx <T> > RetrieveHoisted <T>(ReflectEx.Hoist <T> hoist, Func <TExArgCtx, TEx <float> > indexer) => tac => hoist.Retrieve(indexer(tac), tac);