コード例 #1
0
    void Start()
    {
        _scoreKeeperScript = FindObjectOfType <ScoreKeeperScript>();
        _totalTime         = _scoreKeeperScript._totalScore;

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

      myText.text = ScoreKeeperScript.score.ToString();
      ScoreKeeperScript.Reset();
  }
コード例 #3
0
 void Start()
 {
     //On start
     _scoreKeeperScript = FindObjectOfType <ScoreKeeperScript>();
     _shield            = GameObject.FindGameObjectWithTag("Shield");
     InitilizeVariables();
     _sound = GameObject.Find("Sound");
     _sound.GetComponent <AudioSource>().enabled = false;
 }
コード例 #4
0
 void Awake()
 {
     // Register the singleton
     if (Instance != null)
     {
         Debug.LogError("Multiple instances of ScoreKeeperScript!");
     }
     Instance = this;
 }
コード例 #5
0
 // 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;
 }
コード例 #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");
    }
コード例 #7
0
ファイル: Speler.cs プロジェクト: SelfieCyde/Portfolio
    // 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();
    }
コード例 #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");
        }
    }
コード例 #9
0
 void Start()
 {
     scoreKeeper = GameObject.Find("Score").GetComponent <ScoreKeeperScript>();
 }
コード例 #10
0
 //if we are not the server, we will need our scorekeeper registered with us
 public void RegisterScoreKeeper(ScoreKeeperScript sk)
 {
     scoreKeeper = sk;
 }
コード例 #11
0
 public void ClearScoreKeeper()
 {
     scoreKeeper = null;
 }
コード例 #12
0
 void OnEnable()
 {
     script = target as ScoreKeeperScript;
 }