Exemplo n.º 1
0
    private void OnTriggerEnter(Collider other)
    {
        //death stuffs
        if (other.tag == "Enemy")
        {
            _poppedEffect.Play();
            _controller.Dead(_cubeInfoSO.deathTime);
            print("dead");
        }
        if (other.tag == "TheVoid")
        {
            _controller.Dead(_cubeInfoSO.deathTime, false, false);
            print("dead");
        }
        if (other.tag == "Blaster")
        {
            _controller.Dead(_cubeInfoSO.deathTime);
            Instantiate(_cubeInfoSO.burnedEffectsA[0], transform.position, transform.rotation);
            print("dead");
        }

        if (other.tag == "Pusher")
        {
            _controller.Dead(_cubeInfoSO.deathTime, false, false);
            print("dead");
        }

        if (other.tag == "Hammer")
        {
            _controller.Dead(_cubeInfoSO.deathTime, false, false);
            print("dead");
        }

        if (other.tag == "Smasher")
        {
            _controller.Dead(_cubeInfoSO.deathTime, false, false, false);
            if (!_ground)
            {
                _controller.GetRigidbody().AddForce(Vector3.down * 10, ForceMode.Impulse);
            }

            TheCubeGameManager.playerMesh.transform.localPosition = Vector3.down * 0.5f;
            TheCubeGameManager.playerMesh.transform.localScale    = new Vector3(TheCubeGameManager.playerMesh.transform.localScale.x, TheCubeGameManager.playerMesh.transform.localScale.x / 2, TheCubeGameManager.playerMesh.transform.localScale.z / 10);
            print("dead");
        }

        //other
        if (other.tag == "Launcher")
        {
            print("inLaucher!");
            Launcher launch = other.GetComponent <Launcher>();
            if (launch != null)
            {
                _currentLauncher = launch;
            }

            _inLauncher = true;
        }

        if (other.tag == "Bouncer")
        {
            print("inBouncer!");
            Bouncer bouncer = other.GetComponent <Bouncer>();
            if (bouncer != null)
            {
                _currentBouncer = bouncer;
            }
            _groundJumpActive = false;
            _inBouncer        = true;
        }

        if (other.tag == "Booster")
        {
            print("SPEEDBOOST!");
            _inBooster = true;
        }

        if (other.tag == "Moving")
        {
            print("inMovingObject");
            _onMovingObject = true;
            Rigidbody movingRb = other.GetComponent <Rigidbody>();
            if (movingRb != null)
            {
                _movingRb = movingRb;
            }
        }
        if (other.tag == "CameraEdit")
        {
            _currentCameraEdit = other.GetComponent <CameraEditSettings>();
            if (_currentCameraEdit != null)
            {
                print("moving camera..");
                cameraFollow.SetOffset(_currentCameraEdit.newCameraOffset);
            }
        }
    }