public static void reset() { lines.Clear(); callback = null; state = TextboxState.Hidden; cur_line = cur_pos = 0; last_anim_tick = VERGEGame.game.tick; }
public void TestSetGetMethodStub() { StubContainer <IFoo> container = new StubContainer <IFoo>(); BasicDelegate del = () => { }; container.SetMethodStub(del, 1, true); Assert.AreEqual(del, container.GetMethodStub <BasicDelegate>("Foo")); }
public void TestThatSetStubOverridesExistingStub() { StubContainer <IFoo> container = new StubContainer <IFoo>(); BasicDelegate del = () => { }; BasicDelegate del2 = () => { throw new Exception(); }; container.SetMethodStub(del, Times.Forever, true); container.SetMethodStub(del2, Times.Forever, true); Assert.AreEqual(del2, container.GetMethodStub <BasicDelegate>("Foo")); }
public void TestThatDelegatesWithTheSameSignatureDontConflict() { StubContainer <IFoo> container = new StubContainer <IFoo>(); BasicDelegate del = () => { }; BasicDelegate2 del2 = () => { throw new Exception(); }; container.SetMethodStub(del, Times.Forever, true); container.SetMethodStub(del2, Times.Forever, true); Assert.AreEqual(del, container.GetMethodStub <BasicDelegate>("Foo1")); Assert.AreEqual(del2, container.GetMethodStub <BasicDelegate2>("Foo2")); }
void Die() { isDead = true; Health.s.chaseCheese -= CheckCheeseChase; Health.s.stopChase -= StopChase; DropCheese(); transform.position = new Vector3(1000, 1000, 1000); if (BestOne == ChaseCheese) { BestOne = null; } }
private static void Main() { // Langform // var function = new BasicDelegate(Basic.BasicUsageFunction); // Kurzform BasicDelegate function = Basic.BasicUsageFunction; function?.Invoke(); var retDel = new ReturnDelegate(); ReturnDelegate.Calculator calculator = Add; calculator += delegate(int x, int y) { return(x - y); }; var res = retDel.Process(calculator, 5, 5); Console.WriteLine(res); var loggerDelegate = new StaticParam(); StaticParam.StaticLogHandler myLogger = Logger; // StaticParam.StaticLogHandler myLogger = delegate(string msg) { Console.WriteLine(msg); }; loggerDelegate.Process(myLogger); var fileLogger = new FileLogger(@"C:\Users\Gabriel\Desktop\test\abc.txt"); var member = new MemberFunction(); MemberFunction.LogHandlerMember myFileLogger = null; myFileLogger += fileLogger.Log; myFileLogger += Logger; member.Process(myFileLogger); fileLogger.Close(); var acct = new Account(1000); // acct.OverDrawn += new EventHandler(OnOverDrawn); acct.OverDrawn += OnOverDrawn; acct.Debit(500); acct.Debit(600); acct.OverDrawn -= OnOverDrawn; Console.ReadLine(); }
void CheckCheeseChase() { /*if (GetComponent<Transform>() == null) * return;*/ if (isDead) { return; } float myDist = Vector3.Distance(transform.position, Health.s.activeCheese.transform.position); if (myDist < distance) { if (BestOne != null) { BestOne(false); } BestOne = ChaseCheese; BestOne(true); distance = myDist; } }
public void full_reset() { callback = null; OnDone = null; state = TextboxState.Hidden; cur_line = cur_pos = 0; last_anim_tick = VERGEGame.game.tick; isStarted = false; }
public static void switch_map( String new_map, BasicDelegate doTransition ) { VERGEGame game = VERGEGame.game; // TODO: out-transition here if( game.map != null ) game.map.scripts.do_on_exit(); game.MapContent.Unload(); try { game.map = VERGEGame.game.MapContent.Load<VERGEMap>( new_map ); } catch( Exception ) { game.map = VERGEGame.game.MapContent.Load<VERGEMap>( "maps/" + new_map ); } tileset_override = null; game.init_map( doTransition ); }
public virtual void init_map( BasicDelegate DoTransition ) { // TODO: dehackify this, move to VERGEMap entity_space = new BoundedSpace<Entity>(-screen.width, -screen.height, map.pixel_width + 2*screen.width, map.pixel_height + 2*screen.height); for (int i = 0; i < map.num_entities; i++) { entity_space.Add(map.entities[i]); map.entities[i].set_script(); } for (int i = 0; i < map.num_zones; i++) map.zones[i].set_script(); camera = new Camera(); //camera.bounded = false; camera.mode = CameraMode.FollowPlayer; if (map.scripts != null) { map.scripts.initialize(); if( DoTransition != null ) DoTransition(); map.scripts.do_after_transition(); } BasicDelegate initscript = VERGEGame.game.script<BasicDelegate>( map.initscript ); if( initscript != null ) initscript(); }
public static void switch_map( String new_map, BasicDelegate doTransition ) { VERGEGame game = VERGEGame.game; // TODO: out-transition here if( game.map != null ) game.map.scripts.do_on_exit(); game.MapContent.Unload(); Sprite.clear_cache(); // wipe out cached SpriteBases (since we just nuked their textures) if (System.IO.File.Exists(@"content\" + new_map + ".xnb")) { game.map = VERGEGame.game.MapContent.Load<VERGEMap>( new_map ); } else { game.map = VERGEGame.game.MapContent.Load<VERGEMap>( MAP_LOCATION + new_map ); } tileset_override = null; game.init_map( doTransition ); }