Ejemplo n.º 1
0
    private void CheckForRail()
    {
        isRailGrinding = Physics.Raycast(transform.position, -transform.up, out railhit, CheckDistance, whatIsRail);

        Debug.DrawRay(transform.position, -transform.up * CheckDistance, Color.green);

        //reset double jump (if you have one :D)
        if (isRailGrinding)
        {
            _currentRail           = railhit.collider.gameObject;
            railRotationDifference = transform.rotation.eulerAngles.y - _currentRail.transform.rotation.eulerAngles.y;
            if (_hasCalculatedRail == false)
            {
                tempRailRotation   = railRotationDifference;
                _hasCalculatedRail = true;
            }
            if (!_isCombo)
            {
                ComboStart.Invoke();
                _isCombo = true;
            }
            ScoreIncrease.Invoke();
            MultiplyerIncrease.Invoke();
            transform.rotation = _currentRail.transform.rotation;
            _jumps             = 1;
        }
        else
        {
            _hasCalculatedRail = false;
            ScoreStop.Invoke();
        }
    }
Ejemplo n.º 2
0
    private void CheckForWall() //make sure to call in void Update
    {
        //leave wall run
        if (!isWallLeft && !isWallRight)
        {
            StopWallRun();
        }


        //reset double jump (if you have one :D)
        if (isWallLeft || isWallRight)
        {
            _jumps = 1;
            wallRotationDifference = transform.rotation.eulerAngles.y - _currentWall.transform.rotation.eulerAngles.y;
            if (_hasCalculatedWall == false)
            {
                tempWallRotation   = wallRotationDifference;
                _hasCalculatedWall = true;
            }

            if (wallRotationDifference <= 275 && wallRotationDifference >= 265 || wallRotationDifference >= 85 && wallRotationDifference <= 95)
            {
                isWallLeft  = false;
                isWallRight = false;
            }
            else
            {
                transform.rotation = _currentWall.transform.rotation;
            }
            if (!_isCombo)
            {
                ComboStart.Invoke();
                _isCombo = true;
            }
        }
    }