Advertisement
Guest User

Untitled

a guest
Jan 28th, 2018
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class HardEnemy : MonoBehaviour
  5. {
  6.     private ScoreHRD scoreHRD;              // Reference to the Score script.
  7.    
  8.     private HighScoreHRD highscoreH;
  9.    
  10.     public GameObject NewHighScore;
  11.    
  12.            
  13.     public void OnTriggerEnter (Collider other)
  14.         {
  15.         if (other.gameObject.tag == "Gem")
  16.             {
  17.             GetComponent<ScoreHRD>().scoreHRD += 10;
  18.  
  19.             Destroy (other.gameObject);
  20.  
  21.             }
  22.         }
  23.        
  24.     public void Update()
  25.     {
  26.          if (GetComponent<ScoreHRD>().scoreHRD > PlayerPrefs.GetInt ("highscoreHRD"))
  27.          {
  28.              PlayerPrefs.SetInt ("highscoreHRD", GetComponent<ScoreHRD>().scoreHRD);
  29.              NewHighScore.SetActive (true);
  30.          }
  31.      }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement