Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        button = GetComponent <Button>();
        if (button == null)
        {
            Debug.Log("Tutorial OK Button script could not get a reference to the button sript.");
        }
        else
        {
            button.onClick.AddListener(NextTut);

            bbText = GetComponentInChildren <Text>();
            if (bbText == null)
            {
                Debug.Log("Tutorial Ok button couldnt get reference to its own Text");
            }
        }

        audioOut = GetComponent <AudioSource>();
        if (audioOut == null)
        {
            Debug.Log("Tutorial OK Button couldnt get its Audio Source component.");
        }

        gScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <LerpGameController>();
        if (gScript == null)
        {
            Debug.Log("Tutorial Ok Button script could not get a reference to the game controller.");
        }

        pScript = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <PlayerController>();
        if (pScript == null)
        {
            Debug.Log("Tutorial OK Button script could not get a reference to the Player controller.");
        }

        tutPanel = GetComponentInParent <WinPanel>();
        if (tutPanel == null)
        {
            Debug.Log("Tutorial Ok Button couldnt get a reference to its parent Win Panel Script");
        }

        bPanel = GameObject.FindGameObjectWithTag("uiPanel").GetComponent <BuyPanelScript>();
        if (bPanel == null)
        {
            Debug.Log("Open tutorial Button Couldnt Get reference to the ui Buy Panel");
        }

        progress        = 0;
        tutImage.sprite = tutImages[progress];
        tuts.text       = tutorials[progress];
        bbText.text     = buttonQuotes[progress];
    }
Esempio n. 2
0
    // Use this for initialization
    void Start()
    {
        // charSelected may need to be first, as the below code will disable the parent game object
        charSelected = GameObject.FindGameObjectWithTag("uiCharSelected").GetComponent <Image>();
        if (charSelected == null)
        {
            Debug.Log("Menu button script couldnt get reference to the ui element for Character Selected");
        }



        backButton = GameObject.FindGameObjectWithTag("uiBackButton").GetComponent <Button>();
        if (backButton == null)
        {
            Debug.Log("Menu Button couldnt get a reference to the Back Button");
        }

        buyButton = GameObject.FindGameObjectWithTag("uiBuyButton");
        if (buyButton == null)
        {
            Debug.Log("Menu Button couldnt get a reference to the Buy Button");
        }

        Animator anim = buyButton.GetComponent <Animator>();

        if (anim == null)
        {
            Debug.Log("Menu Button couldnt get a reference to the Buy Button Button component.");
        }

        scrollView = GameObject.FindGameObjectWithTag("ScrollView");
        if (scrollView == null)
        {
            Debug.Log("Menu Button could not get the scrollview reference.");
        }
        else
        {
            scrollRect = scrollView.GetComponent <ScrollRect>();
            if (scrollRect != null)
            {
                scrollRect.horizontalNormalizedPosition = GameSaver.gSaver.scrollViewPosition;
            }
        }

        panel = GameObject.FindGameObjectWithTag("uiPanel");
        if (panel == null)
        {
            Debug.Log("Menu Button could not get the panel reference.");
        }

        backGroundFade = GameObject.FindGameObjectWithTag("uiFade");
        if (backGroundFade == null)
        {
            Debug.Log("Menu Button could not get the backGroundFade reference.");
        }

        button = GetComponent <Button>();
        if (button == null)
        {
            Debug.Log("Menu Button script could not get a reference to the button sript.");
        }
        else
        {
            button.onClick.AddListener(OpenMenu);
            mbText = button.gameObject.GetComponentInChildren <Text>();
            if (mbText == null)
            {
                Debug.Log("Menu Button Text Could not be referenced");
            }
        }

        gScript = GameObject.FindGameObjectWithTag("GameController").GetComponent <LerpGameController>();
        if (gScript == null)
        {
            Debug.Log("Menu Button script could not get a reference to the game controller.");
        }

        pScript = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <PlayerController>();
        if (pScript == null)
        {
            Debug.Log("Menu Button script could not get a reference to the player controller.");
        }

        audioOut = GetComponent <AudioSource>();
        if (audioOut == null)
        {
            Debug.Log("Menu Button couldnt get its Audio Source component.");
        }

        bPanel = GameObject.FindGameObjectWithTag("uiPanel").GetComponent <BuyPanelScript>();
        if (bPanel == null)
        {
            Debug.Log("Menu Button Couldnt Get reference to the ui Buy Panel");
        }

        winPanel = GameObject.FindGameObjectWithTag("uiWinPanel");
        if (winPanel == null)
        {
            Debug.Log("Menu Button Couldnt Get reference to the win Panel");
        }
        else
        {
            winPanel.SetActive(true);
        }

        subWinPanel = GameObject.FindGameObjectWithTag("uiSubWinPanel");
        if (subWinPanel == null)
        {
            Debug.Log("OpenWInPanel in MenuButton coulnt get a reference to the Sub Win Panel");
        }


        // currently selecter lerper text fields
        currentName = GameObject.FindGameObjectWithTag("uiCurrentName").GetComponent <Text>();
        if (currentName == null)
        {
            Debug.Log("Menu Button couldnt get reference to the Current Name field");
        }

        currentJump = GameObject.FindGameObjectWithTag("uiCurrentJump").GetComponent <Text>();
        if (currentJump == null)
        {
            Debug.Log("Menu Button couldnt get reference to the Current Jump field");
        }

        currentDistance = GameObject.FindGameObjectWithTag("uiCurrentDistance").GetComponent <Text>();
        if (currentDistance == null)
        {
            Debug.Log("Menu Button couldnt get reference to the Current Distance field");
        }

        currentLevel = GameObject.FindGameObjectWithTag("uiCurrentLevel").GetComponent <Text>();
        if (currentLevel == null)
        {
            Debug.Log("Menu Button couldnt get reference to the Current Level field");
        }

        // candidate purchase lerper text fields
        charCost = GameObject.FindGameObjectWithTag("uiCharCostField").GetComponent <Text>();
        if (charCost == null)
        {
            Debug.Log("Character button script could not get a reference to the Character Cost Text component.");
        }

        charJump = GameObject.FindGameObjectWithTag("uiJump").GetComponent <Text>();
        if (charJump == null)
        {
            Debug.Log("Character button script could not get a reference to the Character Jump Text component.");
        }

        charDist = GameObject.FindGameObjectWithTag("uiDistance").GetComponent <Text>();
        if (charDist == null)
        {
            Debug.Log("Character button script could not get a reference to the Character Dist Text component.");
        }

        /*
         * charName = GameObject.FindGameObjectWithTag("uiCharName").GetComponent<Text>();
         * if (charName == null)
         *  Debug.Log("Character button script could not get a reference to the Buy Panel Character Name Text component.");
         */

        // ui win panel text fields
        winTime = GameObject.FindGameObjectWithTag("uiTimeTaken").GetComponent <Text>();
        if (winTime == null)
        {
            Debug.Log("Character button script could not get a reference to the Win Panel Time Taken component.");
        }

        winCoins = GameObject.FindGameObjectWithTag("uiCoinsCollected").GetComponent <Text>();
        if (charDist == null)
        {
            Debug.Log("Character button script could not get a reference to the Win Coins Collected text component.");
        }

        charSelectHighLight = GameObject.FindGameObjectWithTag("uiCharHighLight");
        if (charSelectHighLight == null)
        {
            Debug.Log("Menu Button Couldnt get reference to the Character buttons Char Select HighLight Panel");
        }

        //fpPanel.CloseFinalPanel();

        disableMenuButton  = false;
        dontSoundOnStartUp = true;
        buyPanelActive     = true;
        closeMenuOneShot   = true;
        CloseMenu();
        scrollIsActive = false;
        roundOver      = false;
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        selectOneShot = false;

        pScript = GameObject.FindGameObjectWithTag("PlayerController").GetComponent <PlayerController>();
        if (pScript == null)
        {
            Debug.Log("Character Button script could not get a reference to the player controller.");
        }

        charName.text = pScript.GetCharName(charIndex);

        charSelected = GameObject.FindGameObjectWithTag("uiCharSelected").GetComponent <Image>();
        if (charSelected == null)
        {
            Debug.Log("Character button script couldnt get reference to the ui element for Character Selected");
        }

        audioOut = GetComponent <AudioSource>();
        if (audioOut == null)
        {
            Debug.Log("Character Button couldnt get its Audio Source component.");
        }

        scrollView = GameObject.FindGameObjectWithTag("ScrollView");
        if (scrollView == null)
        {
            Debug.Log("Character button could not get the scrollview reference.");
        }
        else
        {
            scrollRect = scrollView.GetComponent <ScrollRect>();;
        }

        bPanel = GameObject.FindGameObjectWithTag("uiPanel").GetComponent <BuyPanelScript>();
        if (bPanel == null)
        {
            Debug.Log("Character Button Couldnt Get reference to the ui Buy Panel");
        }

        button = GetComponent <Button>();
        if (button == null)
        {
            Debug.Log("Character Button script could not get a reference to the button sript.");
        }
        else
        {
            button.onClick.AddListener(SelectChar);
        }

        buyButton = GameObject.FindGameObjectWithTag("uiBuyButton");
        if (buyButton == null)
        {
            Debug.Log("Character button couldnt get a reference to the Buy Button script.");
        }

        menuButton = GameObject.FindGameObjectWithTag("MenuButton").GetComponent <MenuButton>();
        if (menuButton == null)
        {
            Debug.Log("Character button couldnt get a reference to the Menu Button script.");
        }

        buyCanvas = GetComponentInParent <Canvas>();
        if (buyCanvas == null)
        {
            Debug.Log("Character Buttons couldnt get reference to the Buy Canvas");
        }

        updatedOneShot = false;
    }