void FixedUpdate() { // send the current physics state to all clients if (isServer) { // get the current phsyics state //Debug.Log("sending state"); PlayerPhysicsState state = new PlayerPhysicsState(transform.position, rbody.velocity, transform.rotation, rbody.angularVelocity); EventPlayerPhysicsState(state); } if (isClient) { // attempt to sync the local physics state with the last state recieved by the server SyncStateWithServer(); } }
public override void Reset() { base.Reset(); Animation = default(PlayerAnimation); Physics = default(PlayerPhysicsState); ScopeAngle = default(float); IsGrounded = default(bool); IsClingedWall = default(bool); InputJumpedStep = default(int); JumpedStep = default(int); LandedStep = default(int); HorizontalCorrectionStep = default(int); HittedStep = default(int) - PhysicsPlayer.HittingSteps; LastFallingVelocityYFactor = default(float); LandingVelocityYFactor = default(float); IsDead = default(bool); }
internal override void Copy(PhysicsBodyState state) { base.Copy(state); var playerState = (PlayerState)state; Animation = playerState.Animation; Physics = playerState.Physics; ScopeAngle = playerState.ScopeAngle; IsGrounded = playerState.IsGrounded; IsClingedWall = playerState.IsClingedWall; InputJumpedStep = playerState.InputJumpedStep; JumpedStep = playerState.JumpedStep; LandedStep = playerState.LandedStep; HorizontalCorrectionStep = playerState.HorizontalCorrectionStep; HittedStep = playerState.HittedStep; LastFallingVelocityYFactor = playerState.LastFallingVelocityYFactor; LandingVelocityYFactor = playerState.LandingVelocityYFactor; IsDead = playerState.IsDead; }
private void OnServerPlayerPhysicsState(PlayerPhysicsState lastState) { //Debug.Log("got physics state message"); receivedPhysicsState = true; lastPhysicsState = lastState; }
public virtual void AcceleratePush() { playerPhysicsState = PlayerPhysicsState.Accelerating; }
public virtual void RegularPush() { playerPhysicsState = PlayerPhysicsState.RegularMoving; }
void Start() { playerPhysicsState = PlayerPhysicsState.Paused; rigidBody = GetComponent <Rigidbody>(); }