public void SetUp()
        {
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
        }
Ejemplo n.º 2
0
        public void Setup()
        {
            D.onDLog += Console.WriteLine;
            SmartWalkBehaviour.s_logger.AddListener(s => Console.WriteLine("Walk behaviour: " + s));

            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay("../InitData1/"));
            foreach (string s in _world.Preload())
            {
                ;
            }

            _d1 = _world.tingRunner.CreateTing <Door>("DoorOne", new TingTing.WorldCoordinate("Eden", new IntPoint(4, 4)), Direction.LEFT);
            _d2 = _world.tingRunner.CreateTing <Door>("DoorTwo", new TingTing.WorldCoordinate("Hallway", new IntPoint(0, 0)), Direction.RIGHT);
            _d1.targetDoorName = _d2.name;
            _d2.targetDoorName = _d1.name;

            _d3 = _world.tingRunner.CreateTing <Door>("DoorThree", new TingTing.WorldCoordinate("Hallway", new IntPoint(4, 2)), Direction.LEFT);
            _d4 = _world.tingRunner.CreateTing <Door>("DoorFour", new TingTing.WorldCoordinate("Kitchen", new IntPoint(0, 2)), Direction.RIGHT);
            _d3.targetDoorName = _d4.name;
            _d4.targetDoorName = _d3.name;

            _world.roomRunner.GetRoom("Hallway").worldPosition = new IntPoint(4, 4);
            _adam = _world.tingRunner.GetTing <Character>("Adam");
            _eve  = _world.tingRunner.GetTing <Character>("Eva");
        }
Ejemplo n.º 3
0
        public void SetUp()
        {
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
            _eva   = _world.tingRunner.GetTing("Eva") as Character;
        }
Ejemplo n.º 4
0
        public void SetUp()
        {
            D.onDLog += Console.WriteLine;
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
        }
Ejemplo n.º 5
0
        public void SetUp()
        {
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
            _adam  = _world.tingRunner.GetTing("Adam") as Character;
            _eva   = _world.tingRunner.GetTing("Eva") as Character;
            _cube  = _world.tingRunner.GetTing("PowerCube") as MysticalCube;
        }
Ejemplo n.º 6
0
        public void Setup()
        {
            D.onDLog += Console.WriteLine;
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world = new World(i.CreateRelay("../InitData1/"));
            _adam  = _world.tingRunner.GetTing <Character>("Adam");
            _seat  = _world.tingRunner.CreateTing <Seat>("Chair", new WorldCoordinate("Eden", 0, 3));
        }
Ejemplo n.º 7
0
        public void SetUp()
        {
            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();

            _world    = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
            _adam     = _world.tingRunner.GetTing("Adam") as Character;
            _eva      = _world.tingRunner.GetTing("Eva") as Character;
            D.onDLog += (pMessage) => Console.WriteLine(pMessage);
        }
Ejemplo n.º 8
0
 public void TrySavingComputerMemory()
 {
     string saveName = "ComputerMemoryTest.json";
     {
         WorldTestHelper.GenerateInitData();
         InitialSaveFileCreator i = new InitialSaveFileCreator();
         World  world             = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));
         Memory computerMemory    = world.tingRunner.CreateTing <Memory> ("ComputerMemory1", new TingTing.WorldCoordinate("Eden", 2, 3));
         computerMemory["a"] = 42;
         computerMemory["b"] = 100.5;
         world.Save(saveName);
     }
     {
         World  world          = new World(saveName);
         Memory computerMemory = world.tingRunner.GetTing <Memory> ("ComputerMemory1");
         Assert.AreEqual(2, computerMemory.data.Keys.Count);
         Assert.AreEqual(42, computerMemory["a"]);
         Assert.AreEqual(100.5, computerMemory["b"]);
     }
 }
Ejemplo n.º 9
0
        public void CheckBalance()
        {
            WorldCoordinate testDefaultCoordinate = new WorldCoordinate("Eden", IntPoint.Zero);

            WorldTestHelper.GenerateInitData();
            InitialSaveFileCreator i = new InitialSaveFileCreator();
            World world = new World(i.CreateRelay(WorldTestHelper.INIT_DATA_PATH));

            D.onDLog += o => Console.WriteLine("D.Log: " + o);
            world.dialogueRunner.AddOnSomeoneSaidSomethingListener(o => Console.WriteLine("Dialogue: " + o));

            CreditCard card = world.tingRunner.CreateTing <CreditCard> ("Visa", testDefaultCoordinate);

            card.logger.AddListener(o => Console.WriteLine("Card log: " + o));
            card.AddDataListener("dialogueLine", (string oldValue, string newValue) => {
                Console.WriteLine("Card said: " + newValue);
            });
            card.nameOfOwner       = "Eva";
            card.masterProgramName = "EvasCard";

            Computer financeComputer = world.tingRunner.CreateTing <Computer>("FinanceComputer", testDefaultCoordinate);

            financeComputer.masterProgramName = "FinanceComputer";
            financeComputer.hasMemoryAPI      = true;
            financeComputer.masterProgram.Start();

            WorldTestHelper.UpdateWorld(world, 3f);
            card.RunMakeTransactionFunction(100.0f);
            WorldTestHelper.UpdateWorld(world, 3f);

            Console.WriteLine("Evas card errors: ");
            foreach (var error in card.masterProgram.GetErrors())
            {
                Console.WriteLine(error.ToString());
            }

            Console.WriteLine("Finance computer errors: ");
            foreach (var error in financeComputer.masterProgram.GetErrors())
            {
                Console.WriteLine(error.ToString());
            }

            Console.WriteLine("Finance computer output: ");
            PrintOutput(financeComputer);

            Assert.IsNotNull(financeComputer.memory);
            Assert.IsNotNull(financeComputer.memory.data);

            object cashAmount = null;
            bool   gotIt      = financeComputer.memory.data.TryGetValue("Eva", out cashAmount);

            Assert.IsTrue(gotIt);
            Assert.AreEqual(typeof(float), cashAmount.GetType());
            Assert.AreEqual(100.0f, (float)cashAmount);

            card.RunMakeTransactionFunction(-20.0f);
            WorldTestHelper.UpdateWorld(world, 1.0f);

            Assert.IsNotNull(financeComputer.memory);
            Assert.IsNotNull(financeComputer.memory.data);

            object cashAmount2 = null;
            bool   gotIt2      = financeComputer.memory.data.TryGetValue("Eva", out cashAmount2);

            Assert.IsTrue(gotIt2);
            Assert.AreEqual(80.0f, (float)cashAmount2);
        }
 public void Setup()
 {
     WorldTestHelper.GenerateInitData();
 }