Ejemplo n.º 1
0
 void ReLoadingCharacter()
 {
     GlobalCharacterInfo.CHAR_GLOBAL_DEFAULT_DATA.TryGetValue(selectedCharacterType, out currentCharInfo);
     m_stPlayerMove = currentCharInfo.m_sPlayerMove;
     CharaterBaseDataInitialize();
     GraphicDataInitialize();
     WeaponDataInitialize();
 }
    public PlayerLedgeClimbState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;

        _movement = player.Movement;
        _data     = player.Data;
        _sfx      = player.SFX;
    }
Ejemplo n.º 3
0
    public PlayerMoveState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;

        _movement = player.Movement;
        _data     = player.Data;
        _input    = player.Input;
        _animator = player.PlayerAnimator;
    }
Ejemplo n.º 4
0
    public PlayerBounceAttackState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _animator     = player.PlayerAnimator;

        _movement     = player.Movement;
        _data         = player.Data;
        _weaponSystem = player.WeaponSystem;
        _input        = player.Input;
    }
Ejemplo n.º 5
0
    public PlayerWallClimbState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _movement          = player.Movement;
        _data              = player.Data;
        _input             = player.Input;
        _aboveWallDetector = player.EnvironmentDetector.AboveWallDetector;
        _wallDetector      = player.EnvironmentDetector.WallDetector;
    }
    public PlayerGroundedSuperState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _input           = player.Input;
        _data            = player.Data;
        _groundDetector  = player.EnvironmentDetector.GroundDetector;
        _ceilingDetector = player.EnvironmentDetector.CeilingDetector;
        _dashSystem      = player.DashSystem;
    }
Ejemplo n.º 7
0
    public PlayerCrouchState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _movement        = player.Movement;
        _input           = player.Input;
        _data            = player.Data;
        _playerAnimator  = player.PlayerAnimator;
        _ceilingDetector = player.EnvironmentDetector.CeilingDetector;
    }
Ejemplo n.º 8
0
    public PlayerWallGrab(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement = player.Movement;
        _input    = player.Input;
        _data     = player.Data;
        _sfx      = player.SFX;
    }
Ejemplo n.º 9
0
    public PlayerWallSlideState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement = player.Movement;
        _data     = player.Data;
        _input    = player.Input;
        _jumpDust = player.Visuals.JumpDust;
    }
Ejemplo n.º 10
0
    public PlayerLandState(PlayerFSM stateMachine, Player player) : base(stateMachine, player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _input      = player.Input;
        _data       = player.Data;
        _sfx        = player.SFX;
        _dashSystem = player.DashSystem;
        _jumpDust   = player.Visuals.JumpDust;
    }
Ejemplo n.º 11
0
    public PlayerWallSuperState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;

        _data           = player.Data;
        _movement       = player.Movement;
        _input          = player.Input;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
        _wallDetector   = player.EnvironmentDetector.WallDetector;
        _dashSystem     = player.DashSystem;
    }
Ejemplo n.º 12
0
    public PlayerGroundAttackState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _animator     = player.PlayerAnimator;

        _movement       = player.Movement;
        _data           = player.Data;
        _input          = player.Input;
        _weaponSystem   = player.WeaponSystem;
        _dashSystem     = player.DashSystem;
        _weaponData     = player.WeaponSystem.EquippedWeapon;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
    }
Ejemplo n.º 13
0
    public PlayerJumpState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement       = player.Movement;
        _input          = player.Input;
        _data           = player.Data;
        _groundDetector = player.EnvironmentDetector.GroundDetector;
        _dashSystem     = player.DashSystem;
        _sfx            = player.SFX;
        _jumpDust       = player.Visuals.JumpDust;
    }
Ejemplo n.º 14
0
    public PlayerFallingState(PlayerFSM stateMachine, Player player)
    {
        _stateMachine = stateMachine;
        _player       = player;
        _animator     = player.PlayerAnimator;

        _movement          = player.Movement;
        _data              = player.Data;
        _input             = player.Input;
        _groundDetector    = player.EnvironmentDetector.GroundDetector;
        _wallDetector      = player.EnvironmentDetector.WallDetector;
        _aboveWallDetector = player.EnvironmentDetector.AboveWallDetector;

        _dashSystem = player.DashSystem;
    }
    private void InitMoveList()
    {
        moveForward = new PlayerMoveData("MoveForward");
        jump        = new PlayerMoveData("Jump");
        slide       = new PlayerMoveData("Slide");
        knockBack   = new PlayerMoveData("KnockBack");

        moveForward.InitOtherMoveStopList(new List <PlayerMoveData> {
            knockBack
        });
        jump.InitOtherMoveStopList(new List <PlayerMoveData> {
            slide
        });
        slide.InitOtherMoveStopList(new List <PlayerMoveData> {
            jump
        });

        moveList.Add(moveForward);
        moveList.Add(jump);
        moveList.Add(slide);
        moveList.Add(knockBack);
    }
Ejemplo n.º 16
0
    public static void Pmove(ref PlayerMoveData pmd)
    {
        //default
        mins = Vector3.zero;
        maxs = Vector3.zero;

        PlayerMove.pmd = pmd;

        groundplane = null;

        origin    = pmd.inOrigin * 0.125f;
        velocity  = pmd.inVelocity * 0.125f;
        frametime = pmd.frametime;
        pmflags   = pmd.flags;

        if (pmd.addVelocities != Vector3.zero)
        {
            velocity += pmd.addVelocities;
        }

        if (PlayerState.mode == GameMode.flying)
        {
            PM_FlyMove();

            if (PlayerState.Noclip)
            {
                origin += velocity * frametime;
            }
            else
            {
                PM_StepSlideMove_();
            }
            FinishPmove();
            pmd = PlayerMove.pmd;
            return;
        }
        PM_CheckDuck();

        if (pmd.initialSnap)
        {
            PM_InitialSnapPosition();
        }

        PM_CategorizePosition();
        PM_CheckSpecialMovement();

        //drop timing counter
        if (timer > 0)
        {
            float msec = frametime;
            if (msec == 0)
            {
                //?
                msec = 1;
            }
            if (msec >= timer)
            {
                pmflags &= ~PMFlags.PMF_TIME_WATERJUMP;
                timer    = 0;
            }
            else
            {
                timer -= msec;
            }
        }

        if (pmflags.HasFlag(PMFlags.PMF_TIME_WATERJUMP))
        {
            velocity.y -= PlayerState.pm_gravity * frametime;
            if (velocity.y < 0)
            {
                //cancel waterjump when we start falling
                pmflags &= ~PMFlags.PMF_TIME_WATERJUMP;
                timer    = 0;
            }

            PM_StepSlideMove();
        }
        else
        {
            PM_CheckJump();
            PM_Friction();

            if (waterlevel >= 2)
            {
                PM_WaterMove();
            }
            else
            {
                PM_AirMove();
            }
        }
        PM_CategorizePosition();

        FinishPmove();
        pmd = PlayerMove.pmd;
    }
Ejemplo n.º 17
0
    private void FixedUpdate()
    {
        //check if a map is loaded and async is on
        if (Cvar.Integer("maploaded") == 0 || !Globals.async.Boolean)
        {
            return;
        }

        PlayerMoveData pmd = new PlayerMoveData
        {
            inOrigin   = lastAsyncOrigin,
            inVelocity = lastAsyncVelocity,

            inForward     = Camera.transform.forward,
            inRight       = Camera.transform.right,
            camX          = camX,
            camY          = camY,
            addVelocities = lastAsyncAddVelocity,
            gravity       = PlayerState.pm_gravity,
            frametime     = Time.fixedDeltaTime,
            initialSnap   = asyncSnapRequired,
            flags         = asyncFlags
        };

        //run async frame
        PlayerMove.Pmove(ref pmd);

        //snap doesn't allow going back
        if (asyncSnapRequired)
        {
            previous_origin   = pmd.outOrigin;
            asyncSnapRequired = false;
        }

        lastAsyncOrigin      = pmd.outOrigin;
        lastAsyncVelocity    = pmd.outVelocity;
        lastAsyncAddVelocity = Vector3.zero;
        asyncFlags           = pmd.flags;

        //start counting simulated time again
        elapsedAsyncFrametime = 0;

        //overwrite all sync variables with async frame. If everything is done correctly the values should be matching
        origin       = pmd.outOrigin * 0.125f;
        out_origin   = pmd.outOrigin;
        out_velocity = pmd.outVelocity;

        velocity   = pmd.outVelocity * 0.125f;
        pmflags    = pmd.flags;
        viewheight = pmd.viewheight;

        //TODO: is everything below this even needed?
        ApplyPmoveToCamera();

        PlayerState.currentSpeed     = new Vector2(velocity.x, velocity.z).magnitude;
        PlayerState.currentVieweight = viewheight;
        PlayerState.currentOrigin    = origin;

        PlayerState.mins = pmd.mins;
        PlayerState.maxs = pmd.maxs;
    }
Ejemplo n.º 18
0
    private void Update()
    {
        //check if a map is loaded
        if (Cvar.Integer("maploaded") == 0)
        {
            return;
        }

        //mouse movement
        MouseLook();

        PlayerMoveData pmd;

        if (Globals.async.Boolean)
        {
            elapsedAsyncFrametime += Time.deltaTime;

            pmd = new PlayerMoveData
            {
                inOrigin   = lastAsyncOrigin,
                inVelocity = lastAsyncVelocity,

                inForward = Camera.transform.forward,
                inRight   = Camera.transform.right,

                camX = camX,
                camY = camY,

                addVelocities = PlayerState.addVelocities,
                gravity       = PlayerState.pm_gravity,
                frametime     = elapsedAsyncFrametime, //run delta time from last async frame
                initialSnap   = snapRequired,
                flags         = pmflags
            };
        }
        else
        {
            pmd = new PlayerMoveData
            {
                inOrigin   = out_origin,
                inVelocity = out_velocity,

                inForward     = Camera.transform.forward,
                inRight       = Camera.transform.right,
                camX          = camX,
                camY          = camY,
                addVelocities = PlayerState.addVelocities,
                gravity       = PlayerState.pm_gravity,
                frametime     = Time.deltaTime, //run current delta time
                initialSnap   = snapRequired,
                flags         = pmflags
            };
        }

        //queue velocities for async
        lastAsyncAddVelocity     += PlayerState.addVelocities;
        PlayerState.addVelocities = Vector3.zero;

        //get pmove
        PlayerMove.Pmove(ref pmd);

        //play jump sound
        if (pmd.jumped)
        {
            jumpSoundSource.Play();
        }

        //snapped -> position changed by entity. Don't allow going back.
        if (snapRequired)
        {
            previous_origin = pmd.outOrigin;
            snapRequired    = false;
        }

        //set data
        origin   = pmd.outOrigin * 0.125f;
        velocity = pmd.outVelocity * 0.125f;

        pmflags    = pmd.flags;
        viewheight = pmd.viewheight;

        //update camera
        ApplyPmoveToCamera();

        //update player state info
        PlayerState.currentSpeed     = new Vector2(velocity.x, velocity.z).magnitude;
        PlayerState.currentVieweight = viewheight;
        PlayerState.currentOrigin    = origin;

        PlayerState.mins = pmd.mins;
        PlayerState.maxs = pmd.maxs;

        //snap position and store old origin
        out_origin   = origin * 8;
        out_velocity = pmd.outVelocity;

        //FIXME: do this only on async switch
        if (!Globals.async.Boolean)
        {
            lastAsyncAddVelocity = Vector3.zero;
            lastAsyncOrigin      = out_origin;
            lastAsyncVelocity    = out_velocity;
            asyncFlags           = pmflags;
        }
    }
 public PlayerMoveController(PlayerMoveData playerMoveData, PlayerBehaviour playerBehaviour)
 {
     _playerMoveData  = playerMoveData;
     _playerTransform = playerBehaviour.PlayerTransform;
     _rigidbody       = playerBehaviour.Rigidbody2D;
 }