void Start() { _scoreKeeperScript = FindObjectOfType <ScoreKeeperScript>(); _totalTime = _scoreKeeperScript._totalScore; Score.text = "Total Time: " + _totalTime.ToString(); //Displays the score from ScoreKeeperScript }
{ void Start() { Text myText = GetComponent <Text>(); myText.text = ScoreKeeperScript.score.ToString(); ScoreKeeperScript.Reset(); }
void Start() { //On start _scoreKeeperScript = FindObjectOfType <ScoreKeeperScript>(); _shield = GameObject.FindGameObjectWithTag("Shield"); InitilizeVariables(); _sound = GameObject.Find("Sound"); _sound.GetComponent <AudioSource>().enabled = false; }
void Awake() { // Register the singleton if (Instance != null) { Debug.LogError("Multiple instances of ScoreKeeperScript!"); } Instance = this; }
// Use this for initialization void Start() { try { scoreKeeper = FindObjectsOfType <ScoreKeeperScript>()[0]; print("found first!"); } catch { scoreKeeper = FindObjectOfType <ScoreKeeperScript>(); } GetComponent <UnityEngine.UI.Text>().text = "Score: " + scoreKeeper.GetComponent <ScoreKeeperScript>().scoreKept; }
//THIS SHOULD ONLY BE CALLED BY THE HOST PLAYER public void BeginGameAsHost() { if(networkManager.isServer) { networkView.RPC("GameStarting", RPCMode.AllBuffered); scoreKeeper = ((GameObject)Network.Instantiate(Resources.Load("ScoreKeeperObject"), Vector3.zero, Quaternion.identity, (int)NetworkGroup.GAME)).GetComponent<ScoreKeeperScript>(); platformManager.GenerateArena(); networkView.RPC("CreatePlayer", RPCMode.AllBuffered); } else Debug.LogError("A nonhost player has attempted to begin the game"); }
// Use this for initialization void Start() { float distance = transform.position.z - Camera.main.transform.position.z; Vector3 meestlinks = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, distance)); Vector3 meestrechts = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, distance)); xmin = meestlinks.x + padding; xmax = meestrechts.x - padding; Healthbar.value = health; _scoreKeeper = GameObject.Find("ScoreKeeper").GetComponent <ScoreKeeperScript>(); _scoreKeeper.Reset(); }
/// <summary> /// Check for correct emotion and add to score /// </summary> private void OnMouseDown() { Debug.Log("Happy emotion selected"); GameObject deck = GameObject.FindGameObjectWithTag("Deck"); GridOverlayScript overlayScript = deck.GetComponent <GridOverlayScript>(); if (overlayScript.oddEmotionIndex == (int)Emotions.Happy) { Debug.Log("Correct emotion selected"); ScoreKeeperScript scoreKeeper = deck.GetComponent <ScoreKeeperScript>(); scoreKeeper.AddScore(); } else { Debug.Log("Incorrect emotion selected"); } }
void Start() { scoreKeeper = GameObject.Find("Score").GetComponent <ScoreKeeperScript>(); }
//if we are not the server, we will need our scorekeeper registered with us public void RegisterScoreKeeper(ScoreKeeperScript sk) { scoreKeeper = sk; }
public void ClearScoreKeeper() { scoreKeeper = null; }
void OnEnable() { script = target as ScoreKeeperScript; }