public void GetTingOfTypeOnTile() { MyTing myTing = _tingRunner.CreateTing <MyTing>("MyTing", new WorldCoordinate(ROOM_NAME, new IntPoint(0, 0))); Room room = _roomRunner.GetRoom(ROOM_NAME); IntPoint p = new IntPoint(3, 3); myTing.position = new WorldCoordinate(ROOM_NAME, p); PointTileNode tileNode = room.GetTile(p); Assert.AreEqual(null, tileNode.GetOccupantOfType <WeirdTing>()); Assert.AreSame(myTing, tileNode.GetOccupantOfType <MyTing>()); }
public void ShellListeningToValueChange() { bool gotChangeMessage = false; MyTing t = new MyTing(); t.SetInitCreateValues("Monkey", WorldCoordinate.NONE, Direction.UP); t.CreateNewRelayEntry(_table, "MyTing"); ValueEntry <string> .DataChangeHandler handler = (before, after) => { gotChangeMessage = true; }; t.AddDataListener <string>("prefab", handler); new MyTingShell(t); t.prefab = "some other prefab"; Assert.IsTrue(gotChangeMessage); t.RemoveDataListener <string>("prefab", handler); }
public void ShellListeningToValueChange() { bool gotChangeMessage = false; MyTing t = new MyTing(); t.SetInitCreateValues("Monkey", WorldCoordinate.NONE, Direction.UP); t.CreateNewRelayEntry(_table, "MyTing"); ValueEntry<string>.DataChangeHandler handler = (before, after) => { gotChangeMessage = true; }; t.AddDataListener<string>("prefab", handler); new MyTingShell(t); t.prefab = "some other prefab"; Assert.IsTrue(gotChangeMessage); t.RemoveDataListener<string>("prefab", handler); }