private void OnTriggerEnter2D(Collider2D collision) { string tag = collision.gameObject.tag; switch (tag) { case "PowerUp": PowerUpQirn puq = collision.gameObject.GetComponent <PowerUpQirn>(); puq.PowerUp(); break; case "FractalQirn": FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>(); if (fractal) { if (CenterQirn.Instance) { CenterQirn.Instance.AddScore(fractal.Worth); } fractal.PlaySound(); fractal.Pool(); } break; } }
/// <summary> /// Trigger enter event. /// </summary> /// <param name="collision"></param> private void OnTriggerEnter2D(Collider2D collision) { string tag = collision.gameObject.tag; switch (tag) { case "PowerUp": PowerUpQirn puq = collision.gameObject.GetComponent <PowerUpQirn>(); puq.Pool(); break; case "FractalQirn": FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>(); if (fractal) { OnFractalQirnCollided(); AddScore(-(int)(_score * pointDecayFactor)); audioSource.clip = clips[UnityEngine.Random.Range(0, clips.Length)]; audioSource.Play(); if (GameManager.GameMode == GameModes.LIMITED || GameManager.GameMode == GameModes.WARP) { if (_revivesRemaining > 0) { if (canLoseRevives) { _revivesRemaining -= 1; canLoseRevives = false; StartCoroutine(ReviveTimer()); } PopUpManager.Instance.PopUp("PU_Revive"); } else { GameManager.Instance.ChangeGameState(GameStates.POST_PLAY); } } fractal.Pool(); } break; } }
private void OnTriggerEnter2D(Collider2D collision) { string tag = collision.gameObject.tag; switch (tag) { case "FractalQirn": FractalQirn fractal = collision.transform.parent.gameObject.GetComponent <FractalQirn>(); if (fractal) { fractal.Pool(); PivotMaskTowardTarget(collision.transform); BeginDisable(); } break; } }