Beispiel #1
0
 public void Story()
 {
     switch (Game.Instance.story.GetChapter())
     {
     default:
         if (speedChoice != null)
         {
             speedChoice.SetInteractable(true);
             radiusChoice.SetInteractable(true);
             efficiencyChoice.SetInteractable(true);
             accelerationChoice.gameObject.SetActive(true);
             stabilityChoice.gameObject.SetActive(true);
         }
         break;
     }
 }
Beispiel #2
0
    private void Start()
    {
        float startPos = -5;
        float yPos     = startPos;

        for (int i = 0; i < PlayerData.UpgradeTypeAmount; i++)
        {
            // Instantiate
            var choice = Instantiate(choicePrefab);

            // Pos
            choice.transform.SetParent(upgradeListContent, false);
            choice.transform.localScale = Vector3.one;

            var pos = choice.transform.localPosition;
            pos.y = yPos;
            choice.transform.localPosition = pos;
            yPos -= 50;

            //Data
            SetChoiceDisplay(choice, (PlayerData.UpgradeType)i);
            int temp = i;
            choice.SetButtonEvent(() => {
                SetUpgradeInfo((PlayerData.UpgradeType)temp);
                AudioManager.Instance.PlayUISound(choiceClick);
            });
            choice.SetColors(ChoiceOption.defaultNormalColor, ChoiceOption.defaultHoverColor, ChoiceOption.defaultPressedColor);
            choice.SetTextAlignment(TextAlignmentOptions.Center);

            choices.Add(choice);

            switch (i)
            {
            case 0:
                speedChoice = choice;
                speedChoice.SetInteractable(Game.Instance.story.GetChapter() > 4);
                break;

            case 1:
                radiusChoice = choice;
                radiusChoice.SetInteractable(Game.Instance.story.GetChapter() > 4);
                break;

            case 2:
                efficiencyChoice = choice;
                efficiencyChoice.SetInteractable(Game.Instance.story.GetChapter() > 4);
                break;

            case 3:
                //weightChoice = choice;
                break;

            case 4:
                accelerationChoice = choice;
                accelerationChoice.gameObject.SetActive(Game.Instance.story.GetChapter() > 4);
                break;

            case 5:
                stabilityChoice = choice;
                stabilityChoice.gameObject.SetActive(Game.Instance.story.GetChapter() > 4);
                break;

            case 6:
                timeDilationChoice = choice;

                if (!Game.Instance.gameData.FindAtomData(119).IsDiscovered() &&
                    !Game.Instance.gameData.FindAtomData(120).IsDiscovered() &&
                    !Game.Instance.gameData.FindAtomData(121).IsDiscovered())
                {
                    timeDilationChoice.gameObject.SetActive(false);
                    Game.Instance.gameData.OnAtomDiscover += CheckUpgradeUnlock;
                }
                break;
            }
        }

        var sizeD = upgradeListContent.sizeDelta;

        sizeD.y = startPos - yPos + 10;
        upgradeListContent.sizeDelta = sizeD;
    }