コード例 #1
0
ファイル: Options.cs プロジェクト: kathar1211/CryptoCam
 //set control buttons to display current configuration
 void UpdateButtonText()
 {
     ReadyCameraControl.GetComponentInChildren <Text>().text = CustomController.GetButtonInput(Constants.ReadyCamera);
     TakePictureControl.GetComponentInChildren <Text>().text = CustomController.GetButtonInput(Constants.TakePicture);
     ThrowObjectControl.GetComponentInChildren <Text>().text = CustomController.GetButtonInput(Constants.ThrowObject);
     PauseControl.GetComponentInChildren <Text>().text       = CustomController.GetButtonInput(Constants.Pause);
     RunControl.GetComponentInChildren <Text>().text         = CustomController.GetButtonInput(Constants.RunButton);
     CrouchControl.GetComponentInChildren <Text>().text      = CustomController.GetButtonInput(Constants.CrouchButton);
 }
コード例 #2
0
    // Update is called once per frame
    void Update()
    {
        //if all these things are false our job is done here
        if (!needsPhotoHelp && !needsObjectHelp && !showingPrompt && !hidingPrompt)
        {
            return;
        }

        gameTimer += Time.deltaTime;

        //if player uses a function they don't need help
        if (CrossPlatformInputManager.GetButtonDown(Constants.TakePicture))
        {
            needsPhotoHelp = false;
        }
        if (CrossPlatformInputManager.GetButtonDown(Constants.ThrowObject))
        {
            needsObjectHelp = false;
        }

        //start the process of showing the prompt when allotted time has passed
        if (gameTimer >= helpDelay && !showingPrompt && !hidingPrompt)
        {
            //prioritize - show picture prompt first
            if (needsPhotoHelp)
            {
                string display = Constants.PhotoHelpPrompt1.Replace(Constants.ParameterSTR, CustomController.GetButtonInput(Constants.ReadyCamera))
                                 + Constants.PhotoHelpPrompt2.Replace(Constants.ParameterSTR, CustomController.GetButtonInput(Constants.TakePicture));
                helpPrompt.text = display;
                needsPhotoHelp  = false;
            }
            else if (needsObjectHelp)
            {
                helpPrompt.text = Constants.ObjectHelpPrompt.Replace(Constants.ParameterSTR, CustomController.GetButtonInput(Constants.ThrowObject));
                needsObjectHelp = false;
            }
            else
            {
                //safeguard - if no help is needed set text to blank
                helpPrompt.text = "";
            }
            showingPrompt = true;
            gameTimer     = 0;
        }

        //gradually increase opacity to fade in text
        if (showingPrompt)
        {
            helpPrompt.color = new Color(helpPrompt.color.r, helpPrompt.color.g, helpPrompt.color.b, helpPrompt.color.a + opacityIncrement);
            if (gameTimer >= helpDuration)
            {
                showingPrompt = false;
                hidingPrompt  = true;
            }
        }

        //gradually decrease opacity to fade out text
        if (hidingPrompt)
        {
            helpPrompt.color = new Color(helpPrompt.color.r, helpPrompt.color.g, helpPrompt.color.b, helpPrompt.color.a - opacityIncrement);
            if (helpPrompt.color.a <= 0)
            {
                showingPrompt = false;
                hidingPrompt  = false;
                gameTimer     = 0;
            }
        }
    }