Пример #1
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;
 }
Пример #2
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));
 }
Пример #3
0
 public void GetUsedBy(Character pUser, Floppy pFloppy)
 {
     //D.Log(name + " is Getting Used By " + pUser);
     _user = pUser;
     RunProgram (pFloppy);
 }
Пример #4
0
        public void WalkThrough(Character pCharacter)
        {
            if (targetPortal == null) {
                _worldSettings.Notify(pCharacter.name, "This arrow is leading nowhere!");
                return;
            }

            WorldCoordinate newPosition = new WorldCoordinate(targetPortal.room.name, targetPortal.interactionPoints[0]);
            logger.Log(name + " used the portal " + name + " and will now teleport to " + newPosition);
            pCharacter.position = newPosition;
            pCharacter.direction = targetPortal.direction;
            pCharacter.StopAction();
            pCharacter.StartAction("WalkingThroughPortalPhase2", null, 2.2f, 2.2f);
            //pCharacter.StartAction("WalkingThroughDoorPhase2", null, 2.0f, 2.0f);
            //_dialogueRunner.EventHappened(_user.name + "_open_" + name);
        }
Пример #5
0
        public override void PrepareForBeingHacked()
        {
            // Accessing the getter to make sure that a program is generated
            if(masterProgram == null) {
                logger.Log("There was a problem generating the master program");
            }
            else {
                masterProgram.nameOfOwner = name;
            }

            _drinker = null;
        }
Пример #6
0
 public void DrinkFrom(Character pDrinker)
 {
     _drinker = pDrinker;
     masterProgram.maxExecutionTime = 10f;
     masterProgram.Start();
 }
Пример #7
0
 public void Push(Character pUser)
 {
     user = pUser;
     masterProgram.Start();
 }
Пример #8
0
        public void StartedWalkingThrough(Character pCharacter)
        {
            if (pCharacter == null) {
                D.Log ("pCharacter argument to StartedWalkingThrough() for fence " + name + " is null!");
                return;
            }

            user = pCharacter;

            if(user.localPoint == interactionPoints[0]) {
                goalPointIndex = 1;
            } else {
                goalPointIndex = 0;
            }

            //D.Log (pCharacter.name + " started walking through fence " + name);
            masterProgram.Start();

            if(masterProgram.ContainsErrors()) {
                API_Grill();
            }
        }
Пример #9
0
        public void Update(float dt, GameTime pCurrentTime, Character pCharacter, MimanTingRunner pTingRunner, RoomRunner pRoomRunner, DialogueRunner pDialogueRunner, WorldSettings pWorldSettings)
        {
            TimetableSpan currentSpan = GetCurrentSpan(pCurrentTime);

            if(currentSpan != TimetableSpan.NULL) {

                if (pCharacter.isAvatar) {
                    return;
                }

                if(pCharacter.lastTimetableSpan != currentSpan) {
                    if(pCharacter.lastTimetableSpan != TimetableSpan.NULL) {
                        pCharacter.logger.Log(pCharacter.name + " ended span " + pCharacter.lastTimetableSpan.name);
                        pCharacter.lastTimetableSpan.behaviour.OnFinish(pCharacter, pTingRunner, pRoomRunner, pDialogueRunner);
                    } else {
                        pCharacter.logger.Log(pCharacter.name + " ended span NULL");
                    }
                }
                pCharacter.lastTimetableSpan = currentSpan;

                //pCharacter.logger.Log("Current timetable span to update: " + currentSpan.ToString());
                if(pCharacter.timetableTimer <= 0f) {
                    pCharacter.timetableTimer = currentSpan.behaviour.Execute(pCharacter, pTingRunner, pRoomRunner, pDialogueRunner, pWorldSettings);
                    //pCharacter.logger.Log(pCharacter.name + " executed " + currentSpan.behaviour + " and set timetableTimer to " + pCharacter.timetableTimer);
                } else {
                    pCharacter.timetableTimer -= dt;
                    //pCharacter.logger.Log(pCharacter.name + " timetableTimer = " + pCharacter.timetableTimer);
                }
            }
            else {
                D.Log("Found no matching time span in Timetable for character " + pCharacter.name + " at time " + pCurrentTime);
            }
        }
Пример #10
0
        public void EvaWalksWithSaveInTheMiddle()
        {
            const string saveName = "EvaWalksWithSaveInTheMiddle.json";

            // These variables are for checking that everything stays the same after loading the save
            IntPoint midPoint = new IntPoint(-1, -1);
            float walkTimerWhenSaving;
            int walkIteratorWhenSaving;

            {
                _eva.position = new WorldCoordinate("Hallway", IntPoint.Zero);
                _eva.walkSpeed = 1.0f; // 1 tile per second
                _eva.WalkTo(new WorldCoordinate("Hallway", new IntPoint(4, 4)));

                WorldTestHelper.UpdateWorld(_world, 1f);
                Assert.AreEqual("Walking", _eva.actionName);

                WorldTestHelper.UpdateWorld(_world, 2.5f);

                midPoint = _eva.localPoint;
                walkTimerWhenSaving = _eva.walkTimer;
                walkIteratorWhenSaving = _eva.walkIterator;

                _world.Save(saveName);
                _world = null;
            }

            {
                World freshWorld = new World(saveName);

                _eva = freshWorld.tingRunner.GetTing("Eva") as Character;
                Assert.AreEqual(midPoint, _eva.localPoint);
                Assert.AreEqual(walkTimerWhenSaving, _eva.walkTimer);
                Assert.AreEqual(walkIteratorWhenSaving, _eva.walkIterator);

                WorldTestHelper.UpdateWorld(freshWorld, 5.0f);
                Assert.AreEqual(new IntPoint(4, 4), _eva.localPoint);
                Assert.AreEqual("", _eva.actionName);
            }
        }
Пример #11
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);
 }
Пример #12
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;
 }
Пример #13
0
        public void Take(Character pUser)
        {
            _user = pUser;

            charges -= 1;
            masterProgram.maxExecutionTime = 7f;
            masterProgram.Start();

            if(onDrugUse != null) {
                onDrugUse();
            }
        }
Пример #14
0
 public void Fry(Character pUser, MimanTing pTing)
 {
     if (on) {
         _objectOnStove = pTing;
         masterProgram.Start ();
     } else {
         _objectOnStove = null;
         _worldSettings.Notify (pUser.name, "Stove is not on");
     }
 }
Пример #15
0
 public void BeInspected(Character pCharacter)
 {
     _user = pCharacter;
     masterProgram.Start();
 }
Пример #16
0
 public void PushCokeDispenserButton(Character pUser)
 {
     _user = pUser;
     if(dispensedCoke == null) {
         masterProgram.Start ();
     }
     else {
         Say("Can't dispense coke, tray is full", "");
     }
 }
Пример #17
0
 bool IsAllowedToTeleport(Character pUser)
 {
     return pUser != null && !pUser.talking && pUser.conversationTarget == null;
 }