コード例 #1
0
 public void OnTrapLanding()
 {
     SetAnimations(false, false, false, false);
     _animator.SetBool(_deathAnimKey, true);
     _rigidbody2D.simulated = false;
     _sceneController.OnDeath();
 }
コード例 #2
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.gameObject.layer == LayerMask.NameToLayer("Coin"))
        {
            Debug.Log(other);
            OnCoinCollected(other.transform.parent.GetComponent <CoinObjectLogic>());
            return;
        }

        if (other.gameObject.layer == LayerMask.NameToLayer("Time"))
        {
            Debug.Log(other);
            var timeLogic = other.transform.parent.GetComponent <TimeObjectLogic>();
            timeLogic.OnCollected();
            return;
        }

        if (other.gameObject.layer == LayerMask.NameToLayer("Trap"))
        {
            Debug.Log("TRAP: " + other);
            SetAnimations(false, false, false, false);
            _animator.SetBool(_deathAnimKey, true);
            _sceneController.OnDeath();
            return;
        }
    }