예제 #1
0
 public static ItemsRepository Instance()
 {
     if (instance == null)
     {
         instance = new ItemsRepository();
     }
     return(instance);
 }
예제 #2
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == LEAVE)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == TAKE_PI && containsRaspberry)
                {
                    menu.RemoveOption(TAKE_PI);

                    bool taken = GameController.Instance().GetEquipment().Add(ItemsRepository.Instance().Get("raspberry_pi_blank"));
                    if (taken == true)
                    {
                        ((Chest)InteractablesRepository.Instance().Get("chest")).ContainsRaspberry = false;
                        containsRaspberry = false;
                        raspberryTaken    = true;

                        menu = new Menu(new List <string>()
                        {
                            LEAVE
                        });

                        MainQuest.OnRaspberryFound();
                    }
                }
                else if (menu.GetCurrent() == TAKE_DUCK && containsDuck)
                {
                    containsDuck = false;
                    menu.RemoveOption(TAKE_DUCK);

                    bool taken = GameController.Instance().GetEquipment().Add(ItemsRepository.Instance().Get("rubber_duck"));
                    if (taken == true)
                    {
                        ((Chest)InteractablesRepository.Instance().Get("chest")).ContainsDuck = false;
                    }
                }

                return(true);
            }

            return(false);
        }
예제 #3
0
 public bool RemoveBySlug(string slug)
 {
     return(Remove(ItemsRepository.Instance().Get(slug)));
 }
예제 #4
0
 public bool ContainsBySlug(string slug)
 {
     return(Contains(ItemsRepository.Instance().Get(slug)));
 }
예제 #5
0
 public bool AddBySlug(string slug)
 {
     return(Add(ItemsRepository.Instance().Get(slug)));
 }
예제 #6
0
        public bool HandleKeyPress(char choice)
        {
            if (menu.HandleKeyPress(choice))
            {
                return(true);
            }
            else if (choice == ( char )32)
            {
                if (menu.GetCurrent() == CONTROL)
                {
                    state = 1;
                    if (mounted)
                    {
                        menu = new Menu(new List <string>()
                        {
                            FINANCIALS, SILENCE
                        });
                    }
                    else
                    {
                        menu = new Menu(new List <string>()
                        {
                            FAILED
                        });
                    }
                }
                else if (menu.GetCurrent() == FAILED)
                {
                    GameController.Instance().GameOver();
                }
                else if (menu.GetCurrent() == FINANCIALS || (state == 0 && menu.GetCurrent() == SILENCE) || (state == 1 && menu.GetCurrent() == SILENCE))
                {
                    state = 2;
                    menu  = new Menu(new List <string>()
                    {
                        NEXT
                    });
                }
                else if (menu.GetCurrent() == NEXT)
                {
                    state++;
                    if (state == 6)
                    {
                        menu = new Menu(new List <string>()
                        {
                            LET_HIM_GO, TAKE_CARD
                        });
                        MainQuest.OnTyrellLeft();
                    }
                }
                else if (menu.GetCurrent() == LET_HIM_GO)
                {
                    GameController.Instance().SetDialog(null);
                }
                else if (menu.GetCurrent() == TAKE_CARD)
                {
                    state = 7;
                    menu  = new Menu(new List <string>()
                    {
                        END
                    });
                    GameController.Instance().GetEquipment().Add(ItemsRepository.Instance().Get("magnetic_card"));
                }
                else if (menu.GetCurrent() == END)
                {
                    GameController.Instance().SetDialog(null);
                }

                return(true);
            }

            return(false);
        }