public void OnClientInbound(NetEntitySnapshot _snapshot) { CommandPostEntitySnapshot snapshot = (CommandPostEntitySnapshot)_snapshot; positionAnim.SetTarget(new Vector3(snapshot.X, snapshot.Y, snapshot.Z)); if ((positionAnim.Target - positionAnim.Value).Length > 20) { positionAnim.SnapTo(positionAnim.Target); } }
public override void OnEquip() { normalModelOffset = ModelOffset; if (GlobalNetwork.IsClient) { Camera cam = Dash.Engine.Graphics.Camera.Active; fovAnim.SnapTo(cam.FOV); } modelAnim.SnapTo(ModelOffset); base.OnEquip(); }
public ReplicatedPlayer(MasterRenderer renderer, World world, SimpleCamera camera, Vector3 position, Team team) : base(renderer, world, camera, position, team) { this.camera = camera; interpPos = new Vector3Anim(); interpPos.SnapTo(position); yawAnim = new FloatAnim(); pitchAnim = new FloatAnim(); // This is fully server controlled ItemManager.DontUpdateItems = true; ItemManager.IsReplicated = true; CharacterController.IsEnabled = false; CreateStarterBackpack(); AudioBuffer jumpAudioBuffer = AssetManager.LoadSound("Player/jump.wav"); if (jumpAudioBuffer != null) { jumpAudioSource = new AudioSource(jumpAudioBuffer); jumpAudioSource.Gain = 0.2f; jumpAudioSource.MaxDistance = 100f; } AudioBuffer landAudioBuffer = AssetManager.LoadSound("Player/land.wav"); if (landAudioBuffer != null) { landAudioSource = new AudioSource(landAudioBuffer); landAudioSource.Gain = 0.2f; landAudioSource.MaxDistance = 120f; } walkingAudioSource = new CyclicAudioSource("Player/footstep.wav", 1, 0f, relative: false, maxDistance: 100f); runningAudioSource = new CyclicAudioSource("Player/run.wav", 1, 0f, relative: false, maxDistance: 200f); }