public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { stream.SendNext(_spriteRenderer.flipX); stream.SendNext(_playerJump.GetJumpState()); } else { _spriteRenderer.flipX = (bool)stream.ReceiveNext(); var jump_state = (JumpState)stream.ReceiveNext(); if (jump_state != _playerJump.GetJumpState()) { _playerJump.ChangeJumpState(jump_state); bool syncModeEnable = false; bool directlySync = false; switch (_playerJump.GetJumpState()) { case JumpState.Ready: syncModeEnable = true; break; case JumpState.Ground: directlySync = true; break; } _photonTransformView.SetForceSyncMode(syncModeEnable, directlySync); } } }
protected override bool OnStartAction() { base.OnStartAction(); if (_playerJump.GetJumpState() == JumpState.Ground) { _playerJump.enabled = false; _playerMove.enabled = false; _boxCollider2D.enabled = false; _rigidbody2D.bodyType = RigidbodyType2D.Kinematic; _rigidbody2D.simulated = false; _transformView.enabled = false; SpawnTeleportObject(); return(true); } return(false); }