Пример #1
0
    // Update is called once per frame
    void Update()
    {
        MGM.GetComponent <MainGameManager>().currentBlock.clicksNeeded -= getScaledClicks(Time.deltaTime);


        // ShopItemButtons.Count is the number of items the player has already found

        // Loop through every shop item that hasn't been added to the shop yet
        for (int i = ShopItemButtons.Count; i < ShopItems.Count; i++)
        {
            // Check whether the player has passed this item's threshold
            if (ShopItems[i].passedThreshold())
            {
                // Instantiate a new Button
                GameObject newButton = Instantiate(Resources.Load <GameObject>(ShopItems[i].getName()));
                ShopItemButtons.Add(newButton.GetComponent <UnityEngine.UI.Button>());

                // Set the new button to be a child of this button
                newButton.transform.SetParent(this.gameObject.transform);

                newButton.transform.position = new Vector2(newButtonX, newButtonY);
                newButtonY -= newButtonY_change;
                newButton.GetComponent <ShopItemButton>().initialize(this, i);

                itemsUnlocked++;

                updateButtonText(i);

                // Add this shop item to the game
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        if (!GameManager)
        {
            GameManager = FindObjectOfType <MainGameManager>();
        }

        instance = FindObjectOfType <GameManager>();

        if (PlayerPrefs.GetInt("Training_Timer") == 0)
        {
            Time_Text.text = "--:--";
        }

        if (instance.GameMode == 0)
        {
            Level_Text.text = instance.CurrentLevel.ToString();
        }
        else if (instance.GameMode == 1)
        {
            Level_Text.text = "--";
        }

        Target_s_Text.text = GameManager.GetComponent <TargetNumber>().Target_Number.ToString();
    }
Пример #3
0
    void Start()
    {
        if (!GameManager)
        {
            GameManager = FindObjectOfType <MainGameManager>();
        }

        Target_s_Text.text = GameManager.GetComponent <TargetNumber>().Target_Number.ToString();
    }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        if (GameManager)
        {
            TN         = GameManager.GetComponent <TargetNumber>();
            BlockCount = GameManager.GameDifficulty;

            for (int i = 0; i < BlockCount; i++)
            {
                GameObject gO = Instantiate(BlockPrefab, BM.Block_Movable[i].transform.position, BM.Block_Movable[i].transform.rotation);
                gO.transform.SetParent(Parent.transform);
                gO.transform.localScale = new Vector3(1, 1, 1);
            }

            SpawnDone = true;
        }
    }
Пример #5
0
    void FixedUpdate()
    {
        if (GameManager && !bIsDone)
        {
            TargetNumberText.text = GameManager.GetComponent <TargetNumber>().Target_Number.ToString();
            if (TargetCircle_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime > 2)
            {
                Go_Button.transform.gameObject.SetActive(true);
                bIsDone = true;
            }
        }

        if (Target_GUI_Anim.GetCurrentAnimatorStateInfo(0).IsName("Target_GUI") &&
            Target_GUI_Anim.GetCurrentAnimatorStateInfo(0).normalizedTime > 1)
        {
            this.transform.gameObject.SetActive(false);
        }
    }