コード例 #1
0
 // Update is called once per frame
 void Update()
 {
     if (Input.GetKeyDown(key) && inCollision)
     {
         Debug.Log(this.gameObject + "bingo");
         scorePort.AddScore();
         ExitCollision(inCollision);
     }
 }
コード例 #2
0
ファイル: ScoringSystem.cs プロジェクト: britt103/HiveArmada
        /// <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);
            }
        }
コード例 #3
0
ファイル: Item.cs プロジェクト: nozomi203/tenbaier
 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);
     }
 }
コード例 #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();
         }
     }
 }
コード例 #5
0
ファイル: GameResults.cs プロジェクト: joshkillinger/TankDuel
    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);
        }
    }