Example #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(key) && inCollision)
     {
         Debug.Log(this.gameObject + "bingo");
         scorePort.AddScore();
         ExitCollision(inCollision);
     }
 }
Example #2
0
        /// <summary>
        /// Adds points to the player's score.
        /// </summary>
        /// <param name="points"> Number of points to add </param>
        private void AddScore(int points)
        {
            score += points;
            reference.statistics.AddScore(points);

            if (scoreDisplay != null)
            {
                scoreDisplay.AddScore(points);
            }
        }
Example #3
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Player"))
     {
         SoundManager.SingletonInstance.PlaySE("itemget", false, 0.3f);
         scoreDisplay.AddScore(itemId);
         ScoreManager.SingletonInstance.AddItem(itemId, 1);
         Destroy(this.gameObject);
     }
 }
Example #4
0
 void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Interactable")
     {
         Interactable box = col.GetComponent <Interactable>();
         if (!box.scored)
         {
             scoreDisplay.AddScore(col.GetComponent <Interactable>().GetPoints);
             box.scored = true;
             box.Destroy();
         }
     }
 }
Example #5
0
    void Update()
    {
        if (scoreDisplay == null)
        {
            GameObject canvas = GameObject.Find("ScoreCanvas");
            scoreDisplay = canvas.GetComponent <ScoreDisplay>();
        }
        else
        {
            for (int i = 0; i < names.Count; i++)
            {
                ScoreDisplay.Score score = new ScoreDisplay.Score(names[i], scores[i], i);
                scoreDisplay.AddScore(score);
            }

            scoreDisplay.DisplayScores();

            Destroy(gameObject);
        }
    }