void Awake() { if (instance == null) { instance = this; } }
private void OnCollisionEnter2D(Collision2D other) { if (other.gameObject.CompareTag("Enemy")) { Debug.Log("Player Hit"); SFXmanager.PlaySound("enemySound"); counter.GetComponent <MemoryCount>().memories--; } }
private void Start() { SFXmanager = FindObjectOfType <SFXmanager>(); _cats = transform .Cast <Transform>() .Select(trans => trans.gameObject) .ToArray(); _parentObstacle = GetComponentInParent <ObstacleHolder>().Obstacle; if (_parentObstacle == null) { Debug.LogError($"No obstacle found above {name}", this); } Obstacle.OnObstacleEvent += OnObstacleEvent; GameManager.ResetEvent += OnGameReset; SetFrameActive(0); if (testOnStart) { Animate(); } }
private void Awake() { Instance = this; }