Пример #1
0
 private void Start()
 {
     mainCamera  = FindObjectOfType <CameraMovement>();
     player      = FindObjectOfType <Player>();
     currentRoom = FindObjectOfType <CurrentRoom>();
     fader       = GameObject.Find("FaderBlack").GetComponent <UIFader>();
 }
Пример #2
0
        void Take(string itemName)
        {
            if (string.IsNullOrEmpty(itemName))
            {
                Messages.Add("Take what?"); return;
            }

            var item = CurrentRoom.TakeItem(itemName);

            if (item != null)
            {
                if (item.Takeable)
                {
                    Messages.Add($"Added {item.Name} to your inventory");
                    Inventory.Add(item);
                    CompletedEvents.Add($"{item.Name.ToUpper()}TAKEN");
                }
                else
                {
                    Messages.Add($"{item.NonTakeableMessage}");
                }
            }
            else
            {
                Messages.Add($"What are you talking about there is no {itemName}");
            }
        }
Пример #3
0
 private void CheckForVictory()
 {
     if (CurrentRoom.GetCountOfType(typeToWin) >= countToWin)
     {
         Debug.Log("WIN!");
     }
 }
Пример #4
0
 public void LookAt(string targetName = "")
 {
     if (targetName == "")
     {
         CurrentRoom.ExamineRoom();
     }
     else
     {
         if (CurrentRoom.GetAllEntities().TryGet(targetName, out Entity entity))
         {
             Game.WriteLine(entity.Description);
         }
         else if (CurrentRoom.Connections.TryGetValue(targetName, out Door door))
         {
             Game.WriteLine(door.Description);
         }
         else if (Inventory.TryGet(targetName, out Item item))
         {
             Game.WriteLine(item.Description);
         }
         else
         {
             Say("I can't see that anywhere.");
         }
     }
 }
Пример #5
0
 public void UseItem(string itemName)
 {
     // if (CurrentPlayer.Inventory.Count > 0)
     // {
     for (int i = 0; i < CurrentPlayer.Inventory.Count; i++)
     {
         Item item = CurrentPlayer.Inventory[i];
         if (item.Name.ToLower() == itemName)
         {
             CurrentPlayer.UseItem(CurrentPlayer, CurrentRoom, item);
             return;
         }
     }
     for (int i = 0; i < CurrentRoom.Items.Count; i++)
     {
         Item item = CurrentRoom.Items[i];
         if (item.Name.ToLower() == itemName)
         {
             CurrentRoom.UseItem(item);
             return;
         }
     }
     System.Console.WriteLine("Use what?");
     EnterToContinue();
     // }
 }
Пример #6
0
        public void should_run_before_after_routines_from_expects()
        {
            var lamp   = Objects.Get <BrassLantern>();
            var before = false;
            var after  = false;

            lamp.Before <Take>(() =>
            {
                before = true;
                return(false); // not handled
            });

            lamp.After <Take>(() =>
            {
                after = true;
            });

            Assert.True(CurrentRoom.Has <BrassLantern>());

            Execute("take lamp");

            Assert.True(Inventory.Contains <BrassLantern>());
            Assert.False(CurrentRoom.Has <BrassLantern>());

            Assert.True(before);
            Assert.True(after);
        }
Пример #7
0
        public void GetUserInput()
        {
            CurrentRoom.GetRoomDescripition();
            Console.WriteLine("where would you like to go? : ");
            Answer = Console.ReadLine().Split();
            Choice = Answer[0].ToLower();
            Option = Answer[1];
            switch (Choice)
            {
            case "go": Go(Option);
                break;

            case "help": Help(Option);
                break;

            case "take": TakeItem(Option);
                break;

            case "reset": Reset(Option);
                break;

            case "show": Inventory(Option);
                break;

            case "quit": Quit(Option);
                break;

            case "look": Look(Option);
                break;

            default:
                Console.WriteLine("cool... although thats not a command!!");
                break;
            }
        }
Пример #8
0
        //takes item out of inventory

        /*public void Drop(string itemName)
         * {
         *  IItem item = Take(itemName);
         *  if (item != null)
         *  {
         *      CurrentRoom.Drop(item);
         *      OutputMessage("\n" + itemName + " has been dropped");
         *  }
         *  else
         *  {
         *      OutputMessage("\nThe item named " + itemName + " is not in your inventory.");
         *  }
         * }*/

        //adds item to inventory
        public void PickUp(string itemName)
        {
            IItem item = CurrentRoom.Pickup(itemName);

            if (item != null)
            {
                //checks if the items weight is over the bag capacity
                if ((item.Weight + Bag.WeightInBag()) >= Bag.Capacity)
                {
                    OutputMessage("This is to heavy to pick up");
                    CurrentRoom.Drop(item);
                }
                else
                {
                    //checks if the item is too large to be picked up
                    if (item.Volume > Bag.VolumeCapacity)
                    {
                        OutputMessage("This item is to big to carry");
                        CurrentRoom.Drop(item);
                    }
                    else
                    {
                        Give(item);
                        OutputMessage("\n" + itemName + " has been picked up");
                        Notification notification = new Notification("FoundKey", this);
                        NotificationCenter.Instance.PostNotification(notification);
                    }
                }
            }
            else
            {
                CurrentRoom.Drop(item);
                OutputMessage("\nThe item named " + itemName + " is not in the room.");
            }
        }
Пример #9
0
        public void TakeItem(string option)
        {
            Item item = CurrentRoom.Items.Find(i => i.Name == option);

            if (item != null)
            {
                // if (CurrentRoom.Name == "Venice" && CurrentRoom.Items.Contains(item.Name == torch))
                // {

                // }
                CurrentRoom.Items.Remove(item);
                CurrentPlayer.Inventory.Add(item);
                Console.Clear();
                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine();
                Console.WriteLine($"You have picked up {item.Name}: {item.Description} Adding it to your inventory now.");
                Thread.Sleep(2000);
                Console.ResetColor();
                Console.WriteLine();
                CurrentRoom.PrintThirdDescription();
            }
            else
            {
                Console.WriteLine($"{CurrentRoom.Name} does not contain any items to pick up, you may need to define what you want to take or you have already picked this item up.");
            }
        }
Пример #10
0
        private static Room Move(Room room)
        {
            Room nextRoom = room;

            if (!CurrentRoom.IsLit() && !room.Light)
            {
                room = Rooms.Get <Darkness>();
            }

            Context.Story.Location = room;

            if (!room.Visited)
            {
                CurrentRoom.Look(true);

                room.Initial?.Invoke();
            }
            else
            {
                if (!CurrentRoom.IsLit() && room.Visited)
                {
                    nextRoom.DarkToDark();
                }

                CurrentRoom.Look(false);
            }


            room.Visited = true;

            return(nextRoom);
        }
Пример #11
0
    private IEnumerator ChaliceAnimation()
    {
        CurrentRoom currentRoom    = FindObjectOfType <CurrentRoom>();
        Vector2     currentRoomPos =
            currentRoom.GetCurrentRoomCoordinate().GetRoomWorldPosition();
        GameObject curtainsGameObject =
            Instantiate(curtains.gameObject,
                        currentRoomPos,
                        Quaternion.identity);

        player = FindObjectOfType <Player>();
        player.FreezePlayer();
        player.transform.position =
            FindObjectOfType <CurrentRoom>().
            GetCurrentRoomCoordinate().
            GetRoomWorldPosition();
        player.GetComponent <SpriteRenderer>().sortingLayerID = SortingLayer.NameToID("AboveAll");
        Animator playerAnimator = player.GetComponent <Animator>();

        playerAnimator.SetTrigger("chalice");
        // Moves Chalice above player
        this.transform.position =
            (Vector2)player.transform.position + new Vector2(0, 1f);
        this.GetComponent <SpriteRenderer>().sortingLayerID = SortingLayer.NameToID("AboveAll");
        whiteFader = GameObject.Find("FaderWhite").GetComponent <UIFader>();
        yield return(new WaitForSeconds(.5f));

        Coroutine a = StartCoroutine(whiteFader.FadeCanvasGroupDistinct(whiteShineAlpha, shineTime));

        yield return(a);

        yield return(new WaitForSeconds(2f));

        Coroutine b = StartCoroutine(curtainsGameObject.GetComponent <Curtains>().CloseCurtains());
    }
Пример #12
0
        public void UseItem(string itemName)
        {
            var item = CurrentPlayer.Inventory.Find(i => i.Name == itemName);

            item = item == null?CurrentRoom.UseItem(itemName) : item;

            if (item == null)
            {
                System.Console.WriteLine("sorry there is no " + itemName);
                return;
            }
            if (item.ItemUsed)
            {
                System.Console.WriteLine($@"
          Sorry, this item, the {item.Name},  has already been used...
        ");
            }
            else
            {
                System.Console.WriteLine($@"
          You decide to use the item {item.Name}.
          Action:  
        ");
                CurrentPlayer.Inventory.Add(item);
                CurrentRoom.GetDescription();
                item.ItemUsed = false;
            }
            AlterRoom(item);
        }
Пример #13
0
        public void DrawHelp()
        {
            System.Console.WriteLine($@"
                    /~~~~~~~~~~~~~~~~~~~~~/
                   / Surviving Vanuatu!  /
                  /~~~~~~~~~~~~~~~~~~~~~/ 

    Commands available and their options:
    - 'go' <direction>` Moves the player from room to room, e.g. Go Down, type 'gd'
          Directions: 'north', 'south', 'east', 'west', 'down', 'up'
				Available directions are shown in game play.
				
    -  'use <itemName>' Uses an item in a room or from your inventory
		    Possible items: 'egg', 'red_rag', 'doughnut'
    -  'drop <itemName>' Don't use or ignore the item in the room.
		    Example: 'use egg' 
	      Generally use items as they are presented.
    -  'quit' ...  Quits the Game
    -  'help' -  List of commands. Redraws this screen
    -  'look' -  Re-prints the room description
    -  'inventory' prints a list of the items in the players inventory
 
      When the player enters a room they get the room description
  ");
            CurrentRoom.GetDescription();
        }
Пример #14
0
        public void UseItem(string itemName)
        {
            Item item = CurrentPlayer.Inventory.Find(i => i.Name.ToLower() == itemName.ToLower());

            if (item == null)
            {
                System.Console.WriteLine("Invalid option.");
            }
            else if (CurrentRoom.Name == "Room 3" && item.Name.ToLower() == "knife")
            {
                // CurrentPlayer.Inventory.Remove(item);
                CurrentRoom.UseItem(itemName);
                // System.Console.WriteLine("You stab the demon with your demon killing knife and destroy it.  Don't forget to take your knife with you again.");
            }
            else if (CurrentRoom.Name == "Room 4" && item.Name.ToLower() == "brother")
            {
                CurrentPlayer.Inventory.Remove(item);
                // CurrentPlayer.Inventory.Remove("knife");
                System.Console.WriteLine("You pass your brother the knife and run for the keys.  He fights off and kills the demons so you can get the keys.  Don't leave him behind!");
            }
            else if (CurrentRoom.Name == "Outside" && item.Name.ToLower() == "knife")
            {
                CurrentPlayer.Inventory.Remove(item);
                System.Console.WriteLine("You stab the demon with your demon killing knife and destroy it.  You both run to the car to make your escape!");
            }
            else if (CurrentRoom.Name == "Outside" && item.Name.ToLower() == "keys")
            {
                CurrentPlayer.Inventory.Remove(item);
                Win();
            }
            else
            {
                Lose("default");
            }
        }
Пример #15
0
 public void UseItem(string itemName)
 {
     if (itemName == "sword" || itemName == "dagger" || itemName == "5 iron" || itemName == "greatsword")
     {
         Console.WriteLine("You can't use that you must attack with it!");
         return;
     }
     else if (itemName == "ham")
     {
         CurrentPlayer.Health += 25;
     }
     else if (itemName == "potion")
     {
         CurrentPlayer.Health += 50;
     }
     Console.Clear();
     Console.WriteLine($"Name: {CurrentPlayer.Name} | Health: {CurrentPlayer.Health}");
     Console.WriteLine("---------------------------------------------------------------------------------");
     Console.WriteLine(CurrentRoom.Description);
     Console.WriteLine("---------------------------------------------------------------------------------");
     Console.WriteLine($"Used {itemName}");
     for (int i = 0; i < CurrentPlayer.Inventory.Count; i++)
     {
         if (CurrentPlayer.Inventory[i].Name.ToLower() == itemName)
         {
             CurrentRoom.UseItem(CurrentPlayer.Inventory[i]);
             CurrentPlayer.RemoveItem(CurrentPlayer.Inventory[i]);
         }
     }
     Console.WriteLine($"What would you like to do {CurrentPlayer.Name}?");
     return;
 }
Пример #16
0
        public void TakeItem(string itemName)
        {
            int itemIndex = CurrentRoom.IndexOfItemByName(itemName);

            if (itemIndex == -1)
            {
                Console.WriteLine($"You must be hallucinating. That item isn't in this room");
                return;
            }

            // change colors + print name and description of item
            ConsoleColor background = Console.BackgroundColor;
            ConsoleColor foreground = Console.ForegroundColor;

            Console.BackgroundColor = ConsoleColor.Green;
            Console.ForegroundColor = ConsoleColor.White;
            Console.WriteLine($" {CurrentRoom.Items[itemIndex].Name} ");
            Console.BackgroundColor = background;
            Console.ForegroundColor = foreground;
            Console.WriteLine(CurrentRoom.Items[itemIndex].Description);

            if (CurrentRoom.Items[itemIndex].KillsPlayer)
            {
                GameLost = true;
                Console.WriteLine($"You died when you picked up the {itemName}. R.I.P.");
                return;
            }

            CurrentPlayer.Inventory.Add(CurrentRoom.Items[itemIndex]);
            CurrentRoom.RemoveItem(itemIndex);
        }
Пример #17
0
        public void before_routine_blocks_continuation()
        {
            var lamp    = Objects.Get <BrassLantern>();
            var message = "The lamp is glued to the floor.";
            var after   = false;

            lamp.Before <Take>(() =>
            {
                Print(message);
                return(true); // not handled
            });

            lamp.After <Take>(() =>
            {
                after = true;
            });

            Assert.True(CurrentRoom.Has <BrassLantern>());

            Execute("take lamp");

            Assert.False(after);
            Assert.False(Inventory.Contains <BrassLantern>());
            Assert.True(CurrentRoom.Has <BrassLantern>());

            Assert.Contains(message, ConsoleOut);
        }
Пример #18
0
        public void UseItem(string itemName)
        {
            int itemIndex = CurrentPlayer.IndexOfItemByName(itemName);

            if (itemIndex == -1)
            {
                Console.WriteLine($"Do you not know how to check your pockets? You don't even have a {itemName}.");
                return;
            }


            switch (itemName)
            {
            case "key":
                if (!CurrentRoom.Unlock())
                {
                    Console.WriteLine("What do you call someone who tries to unlock a door that doesn't have a lock?");
                    Thread.Sleep(500);
                    Console.WriteLine("Stupid, that's what you call them.");
                    Console.WriteLine("Also, you're out a key.");
                }
                else
                {
                    Console.WriteLine("You unlocked the door!");
                }
                break;

            default:
                Console.WriteLine($"You used your {itemName}, it didn't do anything.");
                break;
            }

            CurrentPlayer.RemoveItem(itemIndex);
        }
Пример #19
0
 private void GenerateRoomNamesToDisplay()
 {
     for (int i = 0; i < ALL_ROOM_NAMES.Length; i++)
     {
         if (RoomToGoTo != null &&
             (ALL_ROOM_NAMES[i].Equals(RoomToGoTo) ||
              ((RoomToGoTo.Contains("quality") || RoomToGoTo.Contains("Quality")) &&
               (ALL_ROOM_NAMES[i].Equals("Quality") || ALL_ROOM_NAMES[i].Equals("Assurance")))))
         {
             prependCharacter = '*';
             appendCharacter  = '*';
         }
         else if (RoomToGoTo == null &&
                  (ALL_ROOM_NAMES[i].Equals(CurrentRoom) ||
                   ((CurrentRoom.Contains("quality") || CurrentRoom.Contains("Quality")) &&
                    (ALL_ROOM_NAMES[i].Equals("Quality") || ALL_ROOM_NAMES[i].Equals("Assurance")))))
         {
             prependCharacter = '*';
             appendCharacter  = '*';
         }
         else
         {
             prependCharacter = ' ';
             appendCharacter  = ' ';
         }
         Rooms[i] = CreateRoomName(ALL_ROOM_NAMES[i]);
     }
 }
Пример #20
0
        protected override void Draw(GameTime gameTime) // calls after Update()
        {
            if (IsActive)
            {
                // FPS and update count debug
                if (_frameCount >= _targetFPS - 1)
                {
                    _frameCount = 0;
                }
                else
                {
                    _frameCount++;
                }

                _frameRate = Math.Round((1 / gameTime.ElapsedGameTime.TotalSeconds), 1);

                GraphicsDevice.Clear(Color.Black);
                SpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, null, _view);

                SpriteBatch.DrawString(Debug.Assets.DebugFont, "                     DrawDebug:[F1]       Pause:[P]       Action:[Arrows][Z][X]      Rooms1&2:[F2][F3]", new Vector2(10, 10), Color.White);
                SpriteBatch.DrawString(Debug.Assets.DebugFont, "_frameCount:  " + _frameCount, new Vector2(10, 36), Color.White);
                SpriteBatch.DrawString(Debug.Assets.DebugFont, "_targetFPS:   " + _targetFPS, new Vector2(10, 48), Color.White);
                SpriteBatch.DrawString(Debug.Assets.DebugFont, "_frameRate:   " + _frameRate, new Vector2(10, 60), Color.White);

                CurrentRoom.Draw();
                SpriteBatch.End();

                base.Draw(gameTime);
            }
        }
Пример #21
0
        public static void TryTakingItem(string itemName)
        {
            List <IItem> itemsInRoom = CurrentRoom.GetItems();

            if (itemsInRoom == null)
            {
                IO.OutputNewLine(GameStrings.NoItemsSeen);
            }
            else
            {
                foreach (IItem item in itemsInRoom)
                {
                    if (item.GetName() == itemName)
                    {
                        // remove the item from the room if taken by player
                        if (Player.TakeItem(item))
                        {
                            CurrentRoom.RemoveItem(item);
                            return;
                        }
                        return;
                    }
                }
            }
            IO.OutputNewLine(GameStrings.NoItemAvailable);
        }
Пример #22
0
        protected override void LoadContent()
        {
            InputProfiles = new Dictionary <string, InputManager>();
            SpriteBatch   = new SpriteBatch(Graphics.GraphicsDevice);
            Rooms         = new RoomHandler();
            Rng           = new Random();

            Debug.Assets.InitDebugAssets();

            InputProfiles["global_keyboard"] = new InputManager();
            GlobalKeyboard = InputProfiles["global_keyboard"];

            Rooms.AddRoom(new TestRoom(new Point(1000, 1000), "test_1_fuji"));
            CurrentRoom = Rooms.GetRoom("test_1_fuji");
            CurrentRoom.LoadContent();
            CurrentRoom.InitializeRoom();

            Rooms.AddRoom(new TestRoom2(new Point(1000, 1000), "test_2_yamato"));
            Rooms.GetRoom("test_2_yamato").LoadContent();
            Rooms.GetRoom("test_2_yamato").InitializeRoom();

            CurrentRoom = Rooms.GetRoom("test_2_yamato");

            _view = Matrix.Identity;
        }
Пример #23
0
 public void TryTalk()
 {
     if (CurrentRoom.NPCsInRoom.Count == 0)
     {
         using (new ColorContext(ColorContext.FailureColor))
         {
             Console.WriteLine("There's no one in the room.");
         }
         return;
     }
     Console.WriteLine("With whom do you want to talk?");
     CurrentRoom.PrintNPCs();
     int.TryParse(Console.ReadLine(), out int talkToNPCInt);
     talkToNPCInt -= 1;
     if (talkToNPCInt >= 0 && talkToNPCInt < CurrentRoom.NPCsInRoom.Count)
     {
         CurrentRoom.NPCsInRoom[talkToNPCInt].Talk(this);
     }
     else
     {
         using (new ColorContext(ColorContext.FailureColor))
         {
             Console.WriteLine("He's not here...");
         }
         return;
     }
 }
Пример #24
0
        public void Go(string direction)
        {
            if (CurrentRoom.Name == "RoomB")
            {
                Console.WriteLine("As you walk through the door, you're met with humungous Demon.  What do you do?");
            }
            if (CurrentRoom.UnlockedStatus == false)
            {
                Console.WriteLine("You push on the door.  Locked.");
            }
            if (CurrentRoom.Name == "RoomA" && direction == "go back")
            {
                Console.WriteLine("Can't go that way");
            }
            if (CurrentRoom.Name == "RoomD" && direction == "go forward")
            {
                Console.WriteLine("Can't go that way");
            }

            else
            {
                CurrentRoom = (Room)CurrentRoom.Go(direction);
                // Console.Clear();
                Console.WriteLine(CurrentRoom.Description);
            }
        }
Пример #25
0
 public void UseItem(string itemName)
 {
     if (itemName == "empty")
     {
         Console.Clear();
         Console.ForegroundColor = ConsoleColor.DarkMagenta;
         Console.WriteLine("You must enter an item name with the \"use\" command.");
         Console.ForegroundColor = ConsoleColor.Gray;
         return;
     }
     for (int i = 0; i < CurrentPlayer.Inventory.Count; i++)
     {
         if (CurrentPlayer.Inventory[i].Name.ToLower() == itemName && CurrentPlayer.Inventory[i].Uses > 0)
         {
             Console.WriteLine(CurrentPlayer.Inventory[i].UseText);
             if (!CurrentPlayer.Inventory[i].PlayerItem)
             {
                 CurrentRoom.UseItem(CurrentPlayer.Inventory[i]);
             }
             else
             {
                 CurrentPlayer.UseItem(CurrentPlayer.Inventory[i]);
             }
             if (CurrentPlayer.Inventory[i].Uses <= 0)
             {
                 if (CurrentPlayer.Inventory[i].RequiredToProceed)
                 {
                     foreach (var room in Rooms)
                     {
                         if (CurrentPlayer.Inventory[i].RequiredLocation == room.Value.Name)
                         {
                             foreach (var lockToCheck in room.Value.Locks)
                             {
                                 // Long shoe-horned way to check if the lock corresponding to the key that broke is still locked. (Only keys are "required to proceed" items)
                                 if (lockToCheck.Value.Type == CurrentPlayer.Inventory[i].Name && lockToCheck.Value.Locked)
                                 {
                                     Console.Clear();
                                     Console.ForegroundColor = ConsoleColor.Red;
                                     Console.WriteLine($"After weeks of searching, you collapse in a heap as your strength fades...\nYou realize that the {CurrentPlayer.Inventory[i].Name} you broke weeks ago was essential to your escape... \nThe darkness takes you.");
                                     Console.ForegroundColor = ConsoleColor.Gray;
                                     CurrentPlayer.Dead      = true;
                                     Reset();
                                 }
                             }
                         }
                     }
                 }
                 else
                 {
                     CurrentPlayer.Inventory.Remove(CurrentPlayer.Inventory[i]);
                 }
             }
             return;
         }
     }
     Console.Clear();
     Console.ForegroundColor = ConsoleColor.DarkMagenta;
     Console.WriteLine($"You do not have any {itemName} in your inventory.");
     Console.ForegroundColor = ConsoleColor.Gray;
 }
Пример #26
0
        public void MessageReceived(object Sender, SocketEventArgs E)
        {
            string Data = Encoding.UTF8.GetString(E.Data);

            string[] Fragments = Data.Split(new[] { "|*|" },
                                            StringSplitOptions.RemoveEmptyEntries);
            if (Fragments[0] != "ChatMessage")
            {
                return;
            }

            Player Speaker = Fragments[1] == "System" ? null : CurrentRoom.Members
                             .Find(O => O.Id == Guid.Parse(Fragments[1]));

            this.Dispatcher.Invoke(() =>
                                   SendMessageAlone(Fragments[2], Speaker,
                                                    Speaker != null && CurrentRoom.IsHost(Speaker)));

            if (CurrentRoom.IsHost(App.CurrentUser))
            {
                var From = E.Socket["User"] as User;
                foreach (var Client in App.Server
                         .Where(Client => !From.Equals(Client["User"])))
                {
                    Client.SendAsync(E.Data);
                }
            }
        }
Пример #27
0
    public void SaveGame()
    {
        CurrentRoom = FindObjectOfType <Room>();
        if (CurrentRoom != null)
        {
            if (locationsStates.ContainsKey(SceneManager.GetActiveScene().name))
            {
                locationsStates[SceneManager.GetActiveScene().name] = CurrentRoom.SaveState();
            }
            else
            {
                locationsStates.Add(SceneManager.GetActiveScene().name, CurrentRoom.SaveState());
            }
        }

        SaveGameData data = new SaveGameData();

        data.itemsId         = InventoryController.Instance.items.Select(i => i.idItem).ToArray();
        data.notesId         = JournalController.Instance.notes.Select(n => n.idNote).ToArray();
        data.tasksId         = JournalController.Instance.tasks.Select(t => t.idTask).ToArray();
        data.completeTasksId = JournalController.Instance.completeTasks.Select(t => t.idTask).ToArray();

        data.locationsStates = locationsStates;

        data.globalValues   = Values;
        data.locationName   = SceneManager.GetActiveScene().name;
        data.playerPosition = new Vector4Serializer(PlayerController.Instance.transform.position);
        data.playerRotation = new Vector4Serializer(PlayerController.Instance.transform.rotation);
        data.playerHealth   = PlayerController.Instance.Health;
        data.equipedWearId  = InventoryController.Instance.CurrentDress == null ? "" : InventoryController.Instance.CurrentDress.idItem;

        SaveLoadController.SaveGame(data);
    }
    public void resetToCurrentLevel()
    {
        string room           = "Room" + CurrentRoom.ToString();
        Room   currentRoomObj = roomInformation[room];
        string wallImageName  = currentRoomObj.wallInformation["Wall" + currentWall.ToString()];

        GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>(room + "/" + wallImageName);

        //GetComponent<SpriteRenderer>().sprite = Resources.Load<Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString());

        if (CurrentRoom == 3 && CurrentWall == 3 && completedScreens.Contains(0) && !completedScreens.Contains(1) && !completedScreens.Contains(2) && !completedScreens.Contains(3))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_Screen_wall_1");
        }
        else if (CurrentRoom == 3 && CurrentWall == 3 && completedScreens.Contains(0) && completedScreens.Contains(1) && !completedScreens.Contains(2) && !completedScreens.Contains(3))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_Screen_wall_2");
        }
        else if (CurrentRoom == 3 && CurrentWall == 3 && completedScreens.Contains(0) && completedScreens.Contains(1) && completedScreens.Contains(2) && !completedScreens.Contains(3))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_Screen_wall_2");
        }
        else if (CurrentRoom == 3 && CurrentWall == 3 && completedScreens.Contains(0) && completedScreens.Contains(1) && !completedScreens.Contains(2) && completedScreens.Contains(3))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_Screen_wall_2");
        }
        else if (CurrentRoom == 3 && CurrentWall == 3 && completedScreens.Contains(0) && completedScreens.Contains(1) && completedScreens.Contains(2) && completedScreens.Contains(3))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_Screen_wall_3");
        }
        if (CurrentRoom == 3 && completedWalls.Contains(currentWall))
        {
            GetComponent <SpriteRenderer>().sprite = Resources.Load <Sprite>("Room" + CurrentRoom.ToString() + "/Wall" + currentWall.ToString() + "_solved");
        }
    }
Пример #29
0
        public void StartGame()
        {
            string greeting = $"Welcome to FBI cell{CurrentRoom.Name}";

            foreach (char letter in greeting)
            {
                System.Console.WriteLine("");
                Thread.Sleep(100);
                System.Console.Write("Destination Available: ");
                CurrentRoom.PrintExits();
            }
            System.Console.Clear();
            System.Console.WriteLine("You are in FBI cell");
            foreach (char letter in greeting)
            {
                Console.WriteLine("........");
            }
            Thread.Sleep(1000);
            System.Console.WriteLine("At unknown location");
            Thread.Sleep(1000);
            System.Console.WriteLine("You been kept for unknown false allegations, as much you remember!......");
            {
                CurrentRoom = (Room)CurrentRoom;
                System.Console.WriteLine("what are you thinking?..");
                System.Console.WriteLine("Are you thinking of escaping?..");
                System.Console.WriteLine("It could be risky, You could die.....Don't Do it!");
                System.Console.WriteLine("But you can try, but you will see consequences, act smart...");
                System.Console.WriteLine("Here is your options.....write \"help\".. if you want to escape...");
Пример #30
0
        private void Active_Click(object Sender, RoutedEventArgs E)
        {
            if (!CurrentRoom.HasJoined(App.CurrentUser.Id) || App.CurrentUser.Id != CurrentRoom.Host.Id)
            {
                MessageBox.Show("您当前没有加入任何一个角色槽,也不是该房间的房主,故无法发出准备就绪之命令。",
                                "准备就绪?", MessageBoxButton.OK, MessageBoxImage.Information);
                return;
            }

            ActiveButton.Content   = "等待中...";
            ActiveButton.IsEnabled = false;
            ActiveButton.ToolTip   = "正等待所有加入角色槽的玩家准备就绪。";

            foreach (var TempGroupItem in GroupStack.Children.OfType <Components.GroupItem>())
            {
                foreach (var ParticipantItem in TempGroupItem.ParticipantStack.Children.OfType <ParticipantItem>())
                {
                    if (ParticipantItem.Participant != null && ParticipantItem.Participant.Id == App.CurrentUser.Id)
                    {
                        ParticipantItem.Ready();
                    }
                }
            }
            DispatcherTimer Timer = new DispatcherTimer()
            {
                Interval = TimeSpan.FromSeconds(0.35)
            };

            Timer.Tick += delegate
            {
                ActiveButton.Foreground = new SolidColorBrush(Color.FromRgb(173, 173, 173));
                Timer.Stop();
            };
            Timer.Start();
        }