コード例 #1
0
 // Start is called before the first frame update
 void Start()
 {
     ScoreHandler  = GameObject.Find("ScoreHandler");
     ScoringScript = ScoreHandler.GetComponent <ScoreHandler>();
     fakecount     = ScoringScript.fakesheepyeeted;
     txt.text      = fakecount.ToString();
 }
コード例 #2
0
        // Start is called before the first frame update
        void Start()
        {
            //Assign score handler object and script from previous scene
            ScoreHandler  = GameObject.Find("ScoreHandler");
            ScoringScript = ScoreHandler.GetComponent <ScoreHandler>();

            //Get timer from previous scene
            timer = ScoringScript.timer;

            //print(timer);

            //Calculate and print time from timer
            ms = (int)(timer * 1000) % 1000;
            string msString = ms.ToString("000");

            sec = (int)(timer % 60);
            //print(sec);
            string secstring = sec.ToString("00");

            min = (int)(timer / 60) % 60;
            //print(min);
            string minstring = min.ToString();

            hour = (int)timer / 3600;
            //print(hour);
            string hourstring = hour.ToString();

            txt.text = minstring + " : " + secstring + " : " + msString;
        }
コード例 #3
0
        // Start is called before the first frame update
        void Start()
        {
            ScoreHandler = GameObject.Find("ScoreHandler");
            scorereadout = this.gameObject;
            //time = scorereadout.transform.GetChild(0);
            //this.gameObject.TimeReadout.text = ScoreHandler.timer;

            ScoringScript = ScoreHandler.GetComponent <ScoreHandler>();
            newTime       = ScoringScript.timer;

            //Assign dark screen's color
            fadeColor = darkScreen.GetComponent <Image>().color;

            //Assign boolean
            disable = false;

            // Gui style
            guiStyle.fontSize         = 32;          //change the font size
            guiStyle.normal.textColor = Color.black; //change the font color
            guiStyle.alignment        = TextAnchor.UpperCenter;
            guiStyle.font             = font;

            // Leaderboard
            localPastScores = GlobalControl.Instance.pastScores;
            localNumOfLeaderboardPlayers = GlobalControl.Instance.numOfLeaderboardPlayers;
            maxNumOfLeaderboard          = GlobalControl.maxNumOfLeaderboard;

            // InputField
            NameInputObj = GameObject.Find("NameInput");
            InputField nameInput = NameInputObj.GetComponent <InputField>();

            // New high score
            if (localNumOfLeaderboardPlayers < maxNumOfLeaderboard || localPastScores.Keys[maxNumOfLeaderboard - 1] < newTime)
            {
                NameInputObj.SetActive(true);
                var se = new InputField.SubmitEvent();
                se.AddListener(SubmitName);
                nameInput.onEndEdit = se;
            }
            else
            {
                NameInputObj.SetActive(false);
            }
        }
コード例 #4
0
        // Start is called before the first frame update
        void Start()
        {
            gaugeTick             = transform.Find("GaugeHand");
            gaugeTick.eulerAngles = new Vector3(0, 0, ZERO_SPEED_ANGLE);

            //Find score handler object and script
            scoreHandlerObj = GameObject.Find("ScoreHandler");
            scoreHandler    = scoreHandlerObj.GetComponent <ScoreHandler>();

            //Assign audio source for warning sounds and start as muted
            source      = this.gameObject.GetComponent <AudioSource>();
            source.mute = true;

            //Calculate warning threshold: currently triggers at 2/3 progress toward losing
            warning          = false;
            warningThreshold = scoreHandler.losingThreshold + ((1 - scoreHandler.losingThreshold) / 3);

            ratiodiff    = 1 - scoreHandler.losingThreshold;
            currentPlace = scoreHandler.currentRatio - scoreHandler.losingThreshold;
        }