Topic: Some code mistake

①ControlsScript.translateInputs()
                    else if (ev.axisRaw < 0) // Down
                    { 
                        inputRef.engineRelatedButton = ButtonPress.Down;
                        inputHeldDown[ButtonPress.Up] = 0;
                        inputHeldDown[inputRef.engineRelatedButton] += UFE.fixedDeltaTime;

                        if (inputHeldDown[inputRef.engineRelatedButton] == UFE.fixedDeltaTime && testMoveExecution(inputRef.engineRelatedButton)) return;

#if !UFE_LITE && !UFE_BASIC
                        if (UFE.config.gameplayType == GameplayType._3DFighter && myInfo.customControls.zAxisMovement && CanWalk())
                            if (inputRef.engineRelatedButton != myInfo.customControls.jumpButton || !myPhysicsScript.IsMoving())// should be "myInfo.customControls.crouchButton"
                                myPhysicsScript.MoveZ(mirror, ev.axisRaw);
#endif
                    }

②MoveSetScript.GetNextMove()
    public void GetNextMove(MoveInfo currentMove, ref MoveInfo storedMove)
    {
        if (currentMove.frameLinks.Length == 0) return;

        foreach(FrameLink frameLink in currentMove.frameLinks){
            if (frameLink.linkableMoves.Length == 0) continue;
            if (frameLink.cancelable){
                foreach (MoveInfo move in frameLink.linkableMoves) {
                    if (move == null) continue;

                    bool gaugePass = true;
                    if (!frameLink.ignoreGauge)
                        foreach (GaugeInfo gaugeInfo in move.gauges)
                            if (!hasEnoughGauge(gaugeInfo._gaugeRequired, (int)gaugeInfo.targetGauge)) gaugePass = false;

                    if (gaugePass &&
                       (move.defaultInputs.buttonExecution.Length == 0 || frameLink.ignoreInputs ||
                       (move.defaultInputs.onReleaseExecution && !move.defaultInputs.requireButtonPress && controlsScript.inputHeldDown[move.defaultInputs.buttonExecution[0]] == 0)))
                        storedMove = InstantiateMove(move);
                        //should return here. Otherwise, storedMove would be assigned many times.
                }
            }
        }
    }

③ControlsScript.ReadMove()
                    opControlsScript.activePullIn.speed = opponentOverride.blendSpeed;
                    opControlsScript.activePullIn._targetDistance = FPVector.Distance(worldTransform.position, opControlsScript.activePullIn.position);    //should be "opControlsScript.activePullIn._targetDistance = FPVector.Distance(opControlsScript.worldTransform.position, opControlsScript.activePullIn.position);"
                    opControlsScript.activePullIn.forceGrounded = false;

④PhysicsScript.ApplyForces()
        if (controlScript.activePullIn != null)
        {
            bool isPulling = FPVector.Distance(opWorldTransform.position, worldTransform.position) >= controlScript.activePullIn._targetDistance ? true : false;    //should be "bool isPulling = FPVector.Distance(controlScript.activePullIn.position, worldTransform.position) >= controlScript.activePullIn._targetDistance ? true : false;"
            bool opIsMoving = false;

Share

Thumbs up Thumbs down