Esempio n. 1
0
    void Start()
    {
        _scoreKeeperScript = FindObjectOfType <ScoreKeeperScript>();
        _totalTime         = _scoreKeeperScript._totalScore;

        Score.text = "Total Time: " + _totalTime.ToString(); //Displays the score from ScoreKeeperScript
    }
Esempio n. 2
0
{ void Start()
  {
      Text myText = GetComponent <Text>();

      myText.text = ScoreKeeperScript.score.ToString();
      ScoreKeeperScript.Reset();
  }
Esempio n. 3
0
 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;
 }
Esempio n. 6
0
    //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");
    }
Esempio n. 7
0
    // 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();
    }
Esempio n. 8
0
    /// <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>();
 }
Esempio n. 10
0
 //if we are not the server, we will need our scorekeeper registered with us
 public void RegisterScoreKeeper(ScoreKeeperScript sk)
 {
     scoreKeeper = sk;
 }
Esempio n. 11
0
 public void ClearScoreKeeper()
 {
     scoreKeeper = null;
 }
Esempio n. 12
0
 void OnEnable()
 {
     script = target as ScoreKeeperScript;
 }