void Start() { playerRigidbody2D = GetComponent <Rigidbody2D>(); _playerHelper = GetComponent <PlayerHelper>(); soundEffector = GetComponent <Player>().soundEffector; joystick = GetComponent <Player>().joystick; }
private void OnDestroy() { if (Singleton == this) { Singleton = null; } }
// Start is called before the first frame update void Start() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); se = GetComponent <SoundEffector>(); speed = idleSpeed; curHP = maxHP; }
private void Awake() { if (Singleton != null && Singleton != this) { Destroy(gameObject); } else if (Singleton == null) { Singleton = this; } }
/// <summary> /// Applies the singleton pattern. /// </summary> private void ApplySingleton() { //Singleton if (Instance == null) { Instance = this; } if (this != Instance) { Destroy(gameObject); } }