dronkowitz

GameManager.cs

Mar 24th, 2021 (edited)
702
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.95 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class GameManager : MonoBehaviour
  6. {
  7.     public static GameManager CurrentGame;
  8.     public static bool ringscheck = false;
  9.  
  10.     GameObject source;
  11.     public AudioClip clip;
  12.     public void Awake()
  13.     {
  14.         CurrentGame = this;
  15.         source = Resources.Load<GameObject>("Audio Object");
  16.     }
  17.     // Start is called before the first frame update
  18.     void Start()
  19.     {
  20.        
  21.     }
  22.  
  23.     // Update is called once per frame
  24.     void Update()
  25.     {
  26.        
  27.     }
  28.  
  29.     public void AddRing(int count)
  30.     {
  31.         GameInstance.currentRings += count;
  32.         if (GameInstance.currentRings % 100 == 0)
  33.  
  34.         {
  35.            
  36.  
  37.            
  38.             GameInstance.livesCount++;
  39.             GameObject ao = Instantiate(source);
  40.             ao.GetComponent<AudioObject>().Setup(clip, transform);
  41.         }
  42.        
  43.        
  44.        
  45.     }
  46. }
  47.  
Add Comment
Please, Sign In to add comment