Exemplo n.º 1
0
 //Displays the endgame statistics about collected HoboCoins and discovered Doggos.
 private void displayStats()
 {
     disableAllWindows();
     StatsWindow.SetActive(true);
     Doggos.text    = StatKeeper.getDoggos() + " / 6";
     HoboCoins.text = StatKeeper.getHobos() + " / 40";
 }
Exemplo n.º 2
0
        void FatherSelected(string father)
        {
            if (father.Equals("Yellow"))
            {
                StatKeeper.setStats(10, 4, 7, 5, 4);

                StatKeeper.SelectFather("Charisma");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
            else if (father.Equals("Blue"))
            {
                StatKeeper.setStats(10, 4, 4, 5, 7);

                StatKeeper.SelectFather("Luck");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
            else if (father.Equals("Bloody"))
            {
                StatKeeper.setStats(10, 7, 4, 5, 4);

                StatKeeper.SelectFather("Strength");

                int temp = SceneManager.GetActiveScene().buildIndex;

                SceneManager.LoadScene(temp + 1);
            }
        }
Exemplo n.º 3
0
        //Updates stats every 20th frame
        void Update()
        {
            //DELETE BEFORE RELEASE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!1
            if (StatKeeper.getHealth() <= 0) //888888888888888888888888888888888888888888888888888888888888888888888888888
            {
                StatKeeper.healPlayer();     //!111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111
            }//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            frames++;
            if (frames % 20 == 0)   //If the remainder of the current frame divided by 20 is 0 run the function.
            {
                UpdateStats();

                if (StatKeeper.getHealth() <= 0)
                {
                    Debug.Log("Player Died !");

                    Time.timeScale = 0f;

                    preventUIOverlap();

                    GameOver.SetActive(true);
                }
            }
        }
Exemplo n.º 4
0
        //Updates stats every 20th frame
        void Update()
        {
            frames++;

            if (frames % 60 == 0)               //If the remainder of the current frame divided by 60 is 0 run the function.

            {
                UpdateStats();

                if (StatKeeper.getHealth() <= 0)
                {
                    Debug.Log("Player Died !");


                    if (!playerDed)
                    {
                        preventUIOverlap();

                        GameOver.SetActive(true);

                        DialogToggle.SetActive(false);

                        playerDed = true;
                    }
                }
            }
        }
Exemplo n.º 5
0
        void Start()
        {
            Destroy(GameObject.Find("GameController"));
            Destroy(GameObject.Find("CheckForInteraction"));
            Destroy(GameObject.Find("InventoryHandler"));

            StatKeeper.ResetStats();
            InventoryHandler.resetInventory();

            PlayButton     = GameObject.Find("Play").GetComponent <Button>();
            AboutButton    = GameObject.Find("About").GetComponent <Button>();
            QuitButton     = GameObject.Find("Quit").GetComponent <Button>();
            HelpButton     = GameObject.Find("Help").GetComponent <Button>();
            continueButton = GameObject.Find("HelpToggle/ContinueButton").GetComponent <Button>();

            AboutToggle = GameObject.Find("AboutToggle");
            ImageToggle = GameObject.Find("ImageToggle");
            HelpToggle  = GameObject.Find("HelpToggle");

            continueButton.onClick.AddListener(() => startSound());

            PlayButton.onClick.AddListener(() => beginGame());
            AboutButton.onClick.AddListener(() => toggleAbout());
            QuitButton.onClick.AddListener(() => Application.Quit());
            HelpButton.onClick.AddListener(() => toggleHelp());

            AboutToggle.SetActive(false);
            HelpToggle.SetActive(false);
            continueButton.gameObject.SetActive(false);
        }
        void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("Doggo"))
            {
                SoundManager.instance.musicSource.PlayOneShot(doggo, 1.0f);

                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));

                StatKeeper.DoggoDiscovered(int.Parse(colli.gameObject.name));
            }

            if (colli.CompareTag("NPC"))
            {
                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));
            }
            else if (colli.CompareTag("HostileNPC") == true)
            {
                StatKeeper.receiveDamage(2);
            }
            else if (colli.CompareTag("YellowKnight") == true)
            {
                if (YellowKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(yellowKnight, 1.0f);

                    toggleFathers();

                    YellowKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BlueKnight") == true)
            {
                if (BlueKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(blueKnight, 1.0f);

                    toggleFathers();

                    BlueKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BloodyKnight") == true)
            {
                if (BloodyKnightToggle.activeSelf == false)
                {
                    SoundManager.instance.musicSource.PlayOneShot(bloodyKnight, 1.0f);

                    toggleFathers();

                    BloodyKnightToggle.SetActive(true);
                }
            }
            else
            {
                toggleFathers();

                dialog.text = DialogScript.getNullDialog();
            }
        }
Exemplo n.º 7
0
        //Continues the game and revives the player
        private void ContinueGame()
        {
            Debug.Log("clicked");

            StatKeeper.healPlayer();

            SceneManager.LoadScene(3);
        }
        void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("Playa"))
            {
                SoundManager.instance.musicSource.PlayOneShot(scream, 1.0f);

                StatKeeper.receiveDamage(4);

                Player.transform.position = entrance;
            }
        }
Exemplo n.º 9
0
        //When Player touches the HoboCoin, it disappears and calls a method to add one HoboCoin into the collectables
        void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("Playa"))
            {
                SoundManager.instance.musicSource.PlayOneShot(coin, 0.5f);

                DestroyObject(this.gameObject);

                StatKeeper.collectHoboCoin();
            }
        }
Exemplo n.º 10
0
        //Continues the game and revives the player
        public void ContinueGame()
        {
            playerDed = false;
            StatKeeper.healPlayer();

            Debug.Log("Continuing game from the checkpoint");

            StatKeeper.resetHoboCoin();
            InventoryHandler.resetInventory();

            SceneManager.LoadScene(3);
        }
Exemplo n.º 11
0
        //Collects all of the stats into a string, which is displayed in the stats window on UI
        public string DisplayStats()
        {
            int    amount = StatKeeper.getCoinAmount();
            string temp   = "" +

                            "Health   " + this.Health + "\r\n\r\n" +
                            "Strength   " + this.Strength + "\r\n" +
                            "Charisma   " + this.Charisma + "\r\n" +
                            "Intelligence   " + this.Intelligence + "\r\n" +
                            "Luck   " + this.Luck + "\r\n" +
                            "HoboCoins found    " + amount;

            return(temp);
        }
Exemplo n.º 12
0
        // Displays Stats window on UI
        private void toggleStats()
        {
            preventUIOverlap();                                     //Hiding other menus in order to avoid them overlapping

            if (Stats.activeSelf == false)
            {
                statsText.text = StatKeeper.getStats();
                Stats.SetActive(true);
            }
            else
            {
                Stats.SetActive(false);
            }
        }
Exemplo n.º 13
0
        //Checks which trait is selected and compares it to selected father. Activates story windows accordingly.
        private void traitSelected(string skill)
        {
            if (skill.Equals("Strength"))
            {
                if (skill.Equals(StatKeeper.getFather()))
                {
                    EndIntro.SetActive(false);

                    EndStrGood.SetActive(true);
                }
                else
                {
                    EndIntro.SetActive(false);

                    EndStrBad.SetActive(true);
                }
            }

            if (skill.Equals("Luck"))
            {
                if (skill.Equals(StatKeeper.getFather()))
                {
                    EndIntro.SetActive(false);

                    EndLckGood.SetActive(true);
                }
                else
                {
                    EndIntro.SetActive(false);

                    EndLckBad.SetActive(true);
                }
            }

            if (skill.Equals("Charisma"))
            {
                if (skill.Equals(StatKeeper.getFather()))
                {
                    EndIntro.SetActive(false);

                    EndChrGood.SetActive(true);
                }
                else
                {
                    EndIntro.SetActive(false);

                    EndChrBad.SetActive(true);
                }
            }
        }
Exemplo n.º 14
0
        //displays Minimap window on UI
        private void toggleMap()                    //Method for showing/hiding minimap of the current scene
        {
            Debug.Log("Map toggle");
            preventUIOverlap();             //Hiding other menus in order to avoid them overlapping

            if (Map.activeSelf == true)
            {
                Map.SetActive(false);
                statsText.text = StatKeeper.getStats();
            }
            else
            {
                Map.SetActive(true);
            }
        }
Exemplo n.º 15
0
        void OnTriggerEnter2D(Collider2D colli)
        {
            if (colli.CompareTag("NPC"))
            {
                dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));

                /*}else if (colli.CompareTag("Wench")) {
                 * dialog.text = DialogScript.getDialog(int.Parse(colli.gameObject.name));
                 */
            }
            else if (colli.CompareTag("HiddenHoboCoin") == true)
            {
                Debug.Log("Oh look, a HoboCoin !");

                StatKeeper.collectHoboCoin();
            }
            else if (colli.CompareTag("HostileNPC") == true)
            {
                StatKeeper.receiveDamage(2);
            }
            else if (colli.CompareTag("YellowKnight") == true)
            {
                if (YellowKnightToggle.activeSelf == false)
                {
                    YellowKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BlueKnight") == true)
            {
                if (BlueKnightToggle.activeSelf == false)
                {
                    BlueKnightToggle.SetActive(true);
                }
            }
            else if (colli.CompareTag("BloodyKnight") == true)
            {
                if (BloodyKnightToggle.activeSelf == false)
                {
                    BloodyKnightToggle.SetActive(true);
                }
            }
            else
            {
                dialog.text = DialogScript.getNullDialog();
            }
        }
        void Start()
        {
            Destroy(GameObject.Find("GameController"));

            StatKeeper.resetHoboCoin();

            PlayButton  = GameObject.Find("Play").GetComponent <Button>();
            AboutButton = GameObject.Find("About").GetComponent <Button>();
            QuitButton  = GameObject.Find("Quit").GetComponent <Button>();

            AboutToggle = GameObject.Find("AboutToggle");
            ImageToggle = GameObject.Find("ImageToggle");

            PlayButton.onClick.AddListener(() => startGame());
            AboutButton.onClick.AddListener(() => toggleAbout());
            QuitButton.onClick.AddListener(() => Application.Quit());

            AboutToggle.SetActive(false);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Doggos the discovered = checks if the doggo is already discovered, otherwise sets it as discovered and updates discoveredDoggos integer.
        /// </summary>
        /// <param name="doggonumber">Doggonumber.</param>
        public static void DoggoDiscovered(int doggonumber)
        {
            if (doggos [doggonumber])
            {
                Debug.Log("Already found this Doggo !");
            }
            else
            {
                markAsFound(doggonumber);

                if (doggonumber == 22)
                {
                    StatKeeper.collectHoboCoin();
                }

                discoveredDoggos++;

                Debug.Log("Doggos found: " + discoveredDoggos);
            }
        }
Exemplo n.º 18
0
 //Uses one potion and heals the player back to full health
 public void usePotion()
 {
     if (potionAmount > 1 && potionAmount != 0)
     {
         potionAmount--;
         Debug.Log("Potions left :" + potionAmount);
         StatKeeper.healPlayer();
         potionText.text = "Potion (" + potionAmount + ")";
     }
     else if (potionAmount == 1)
     {
         potionAmount--;
         StatKeeper.healPlayer();
         potionText.text = "Potion (" + potionAmount + ")";
         potionsUsed     = true;
         Potion.SetActive(false);
     }
     else
     {
         Potion.SetActive(false);
     }
 }
        void Awake()
        {
            dialog = GameObject.Find("ShowDialog/DialogBox").GetComponent <Text>();


            if (SceneManager.GetActiveScene().name.Equals("Childhood room 1"))
            {
                StatKeeper.setStats(5, 0, 0, 0, 0);

                //Finds the objects and assings the correct methods if you click the buttons
                YellowKnightToggle = GameObject.Find("YellowKnightToggle");
                YellowYes          = GameObject.Find("YellowKnightToggle/YesButton").GetComponent <Button> ();
                YellowNo           = GameObject.Find("YellowKnightToggle/NoButton").GetComponent <Button> ();

                BlueKnightToggle = GameObject.Find("BlueKnightToggle");
                BlueYes          = GameObject.Find("BlueKnightToggle/YesButton").GetComponent <Button> ();
                BlueNo           = GameObject.Find("BlueKnightToggle/NoButton").GetComponent <Button> ();

                BloodyKnightToggle = GameObject.Find("BloodyKnightToggle");
                BloodyYes          = GameObject.Find("BloodyKnightToggle/YesButton").GetComponent <Button> ();
                BloodyNo           = GameObject.Find("BloodyKnightToggle/NoButton").GetComponent <Button> ();

                YellowYes.onClick.AddListener(() => FatherSelected("Yellow"));
                YellowNo.onClick.AddListener(() => resumeGame());

                BlueYes.onClick.AddListener(() => FatherSelected("Blue"));
                BlueNo.onClick.AddListener(() => resumeGame());

                BloodyYes.onClick.AddListener(() => FatherSelected("Bloody"));
                BloodyNo.onClick.AddListener(() => resumeGame());

                YellowKnightToggle.SetActive(false);
                BlueKnightToggle.SetActive(false);
                BloodyKnightToggle.SetActive(false);

                toggleFathers();
            }
        }
Exemplo n.º 20
0
 private void UpdateStats()
 {
     statsText.text = StatKeeper.getStats();
 }
Exemplo n.º 21
0
 // Update is called once per frame
 void Update()
 {
     health.text = StatKeeper.getHealthAmount();
 }