コード例 #1
0
    //cancel actions like jumping, crouching, sprinting, reloading, and weapon switching
    //so player resumes after camera switch in a neutral state
    void CancelPlayerActions()
    {
        WeaponBehavior CurrentWeaponBehaviorComponent = PlayerWeaponsComponent.CurrentWeaponBehaviorComponent;

        PlayerWeaponsComponent.StopAllCoroutines();
        CurrentWeaponBehaviorComponent.StopAllCoroutines();

        FPSWalkerComponent.jumping     = false;
        FPSWalkerComponent.landState   = false;
        FPSWalkerComponent.jumpfxstate = true;

        FPSWalkerComponent.crouched    = false;
        FPSWalkerComponent.crouchState = false;
        FPSWalkerComponent.crouchRisen = true;

        FPSWalkerComponent.prone      = false;
        FPSWalkerComponent.proneState = false;
        FPSWalkerComponent.proneRisen = true;

        CurrentWeaponBehaviorComponent.gunAnglesTarget = Vector3.zero;

        if (PlayerWeaponsComponent.currentWeapon == PlayerWeaponsComponent.grenadeWeapon && !CurrentWeaponBehaviorComponent.cycleSelect)
        {
            PlayerWeaponsComponent.grenadeThrownState = true;
        }
        else
        {
            PlayerWeaponsComponent.grenadeThrownState = false;
        }

        PlayerWeaponsComponent.offhandThrowActive         = false;
        PlayerWeaponsComponent.pullGrenadeState           = false;
        CurrentWeaponBehaviorComponent.pullAnimState      = false;
        CurrentWeaponBehaviorComponent.fireOnReleaseState = false;
        CurrentWeaponBehaviorComponent.doReleaseFire      = false;
        CurrentWeaponBehaviorComponent.releaseAnimState   = false;
        CurrentWeaponBehaviorComponent.fireHoldTimer      = 0.0f;

        IronsightsComponent.switchMove = 0.0f;
        IronsightsComponent.reloading  = false;

        FPSPlayerComponent.zoomed   = false;
        IronsightsComponent.newFov  = IronsightsComponent.defaultFov;
        IronsightsComponent.nextFov = IronsightsComponent.defaultFov;

        FPSWalkerComponent.cancelSprint = true;
        FPSWalkerComponent.sprintActive = false;
        FPSWalkerComponent.jumping      = false;
        FPSWalkerComponent.landState    = false;
        FPSWalkerComponent.jumpfxstate  = true;

        PlayerWeaponsComponent.cameraToggleState = true;
        PlayerWeaponsComponent.cameraToggleTime  = Time.time;
        PlayerCharacterComponent.lastWeapon      = -1;
        PlayerCharacterComponent.fireTime        = -16;
        PlayerCharacterComponent.reloadStartTime = -16;

        CurrentWeaponBehaviorComponent.CancelWeaponPull();

        IronsightsComponent.zPosRecNext             = 0.0f;
        IronsightsComponent.zPosRec                 = 0.0f;
        CurrentWeaponBehaviorComponent.fireHoldMult = 0.0f;

        PlayerCharacterComponent.SelectCurrentWeapon();
    }