Пример #1
0
        // Breed with no pesky warnings
        public void BreedWithNoWarnings()
        {
            WarningPanel1.SetActive(false);
            int temp = Random.Range(1, 5);

            GameObject[] puppies = new GameObject[temp];
            for (int i = 0; i < temp; i++)
            {
                puppies[i] = MakeNewDog();
                puppies[i].transform.SetParent(Holder.transform);
                if (GameManager.Instance.IsFinalDog(puppies[i].GetComponent <Dog>()))
                {
                    _finalDogFound = true;
                    _winningDog    = puppies[i];
                }
            }
            if (_finalDogFound)
            {
                _winningDog.GetComponent <Card>().OpenFinalDog();
            }
            else
            {
                if (!_secondBirthDone)
                {
                    _secondBirthDone = true;
                    GameManager.Instance.DialogueManager.OpenDialogue(GameManager.Instance.CurrentLevel + "/secondBirth");
                }
                _puppyManager.OpenPuppyManager(puppies);
                GameManager.Instance.SoundManager.PlaySoundEffect("Sound/puppy.wav");

                switch (BreedingType)
                {
                case 1:
                    GameManager.Instance.GeneticVarience.Value -= 15;
                    break;

                case 2:
                    GameManager.Instance.GeneticVarience.Value -= 5;
                    break;
                }
            }

            ExitBreedingMenu();
            GameManager.Instance.SideBar.SetBool("Open", false);
        }
Пример #2
0
        // Breeds the two Dogs
        public void Breed()
        {
            int numberOfDogs = 0;

            if (WarningPanel.activeSelf)
            {
                return;
            }

            for (int i = 0; i < _cardStatsText.Length; i++)
            {
                if (_cardSlots.GetComponentsInChildren <CardSlot>()[i].Item != null)
                {
                    numberOfDogs++;
                }
            }

            switch (numberOfDogs)
            {
            case 0:
                WarningPanel.GetComponentInChildren <Text>().text = "No dogs selected!";
                WarningPanel.SetActive(true);
                break;

            case 1:
                WarningPanel.GetComponentInChildren <Text>().text = "You need two dogs in order to breed them!";
                WarningPanel.SetActive(true);
                break;

            default:
                if (_cardSlots.GetComponentsInChildren <CardSlot>()[0].Item.GetComponent <Dog>().ReturnSex() ==
                    _cardSlots.GetComponentsInChildren <CardSlot>()[1].Item.GetComponent <Dog>().ReturnSex())
                {
                    WarningPanel.GetComponentInChildren <Text>().text = "The dogs need to be a different gender!";
                    WarningPanel.SetActive(true);
                }
                else if (
                    _cardSlots.GetComponentsInChildren <CardSlot>()[0].Item.GetComponent <Dog>()
                    .ReturnSiblings()
                    .Contains(_cardSlots.GetComponentsInChildren <CardSlot>()[1].Item))
                {
                    WarningPanel1.GetComponentInChildren <Text>().text =
                        "These dogs are siblings! If you breed them you will lose 15% of the genetic diversity!";
                    WarningPanel1.SetActive(true);
                    BreedingType = 1;
                }
                else if (_cardSlots.GetComponentsInChildren <CardSlot>()[0].Item.GetComponent <Dog>().ReturnHalfSiblings().Contains(_cardSlots.GetComponentsInChildren <CardSlot>()[1].Item))
                {
                    WarningPanel1.GetComponentInChildren <Text>().text =
                        "These dogs are half-siblings! If you breed them you will lose 5% of the genetic diversity!";
                    WarningPanel1.SetActive(true);
                    BreedingType = 2;
                }
                else
                {
                    if (!_firstBirthDone)
                    {
                        _firstBirthDone = true;
                        GameObject[] puppies = new GameObject[2];
                        for (int i = 0; i < 2; i++)
                        {
                            puppies[i] = MakeNewDog(-40, -30);
                            puppies[i].transform.SetParent(Holder.transform);
                        }
                        _puppyManager.OpenPuppyManager(puppies);
                        GameManager.Instance.SoundManager.PlaySoundEffect("Sound/puppy.wav");
                        GameManager.Instance.DialogueManager.OpenDialogue(
                            GameManager.Instance.CurrentLevel +
                            "/firstBirth");
                    }
                    else
                    {
                        int          temp    = Random.Range(1, 5);
                        GameObject[] puppies = new GameObject[temp];
                        for (int i = 0; i < temp; i++)
                        {
                            puppies[i] = MakeNewDog();
                            puppies[i].transform.SetParent(Holder.transform);
                            if (GameManager.Instance.IsFinalDog(puppies[i].GetComponent <Dog>()))
                            {
                                _finalDogFound = true;
                                _winningDog    = puppies[i];
                            }
                        }
                        if (_finalDogFound)
                        {
                            _winningDog.GetComponent <Card>().OpenFinalDog();
                        }
                        else
                        {
                            if (!_secondBirthDone)
                            {
                                _secondBirthDone = true;
                                GameManager.Instance.DialogueManager.OpenDialogue(
                                    GameManager.Instance.CurrentLevel +
                                    "/secondBirth");
                            }
                            _puppyManager.OpenPuppyManager(puppies);
                            GameManager.Instance.SoundManager.PlaySoundEffect("Sound/puppy.wav");
                        }
                    }
                    ExitBreedingMenu();
                    GameManager.Instance.SideBar.SetBool("Open", false);
                }
                break;
            }
        }