public ClientMPPlayer(MasterRenderer renderer, World world, Camera camera, Vector3 position, Team team) : base(renderer, world, camera, position, team) { this.camera = camera; camfx = new CameraFX(this, camera); // Setup ClientInput Snapshot AOSClient client = AOSClient.Instance; SnapshotNetComponent snc = client.GetComponent <SnapshotNetComponent>(); SnapshotSystem ss = snc.SnapshotSystem; ClientSnapshot = new ClientPlayerSnapshot(ss, client.ServerConnection); Camera.Active.FOV = Camera.Active.DefaultFOV; Camera.Active.FPSMouseSensitivity = Camera.Active.DefaultFPSMouseSensitivity; Camera.Active.ArcBallMouseSensitivity = Camera.Active.DefaultArcBallMouseSensitivity; CreateStarterBackpack(); AudioBuffer hitAudioBuffer = AssetManager.LoadSound("Impacts/hit-player-local.wav"); if (hitAudioBuffer != null) { hitAudioSource = new AudioSource(hitAudioBuffer); hitAudioSource.IsSourceRelative = true; hitAudioSource.Gain = 0.2f; } AudioBuffer flashlightAudioBuffer = AssetManager.LoadSound("Player/flashlight.wav"); if (flashlightAudioBuffer != null) { flashlightAudioSource = new AudioSource(flashlightAudioBuffer); flashlightAudioSource.IsSourceRelative = true; flashlightAudioSource.Gain = 0.2f; } AudioBuffer jumpAudioBuffer = AssetManager.LoadSound("Player/jump.wav"); if (jumpAudioBuffer != null) { jumpAudioSource = new AudioSource(jumpAudioBuffer); jumpAudioSource.IsSourceRelative = true; jumpAudioSource.Gain = 0.2f; } AudioBuffer landAudioBuffer = AssetManager.LoadSound("Player/land.wav"); if (landAudioBuffer != null) { landAudioSource = new AudioSource(landAudioBuffer); landAudioSource.IsSourceRelative = true; landAudioSource.Gain = 0.2f; } walkingAudioSource = new CyclicAudioSource("Player/footstep.wav", 8, 0f); runningAudioSource = new CyclicAudioSource("Player/run.wav", 12, 0f); }
public CharacterSnapshotSystem(SnapshotNetComponent snapshotComponent, SnapshotSystem deltaSnapshotSystem) { this.snapshotComponent = snapshotComponent; this.deltaSnapshotSystem = deltaSnapshotSystem; players = new Dictionary <ushort, ClientPlayer>(); DashCMD.SetCVar("log_css", false); }
public NetPlayerComponent(AOSClient client) : base(client) { netPlayers = new Dictionary <ushort, NetworkPlayer>(); channel = client.GetChannel(AOSChannelType.NetInterface); snapshotComponent = client.GetComponent <SnapshotNetComponent>(); channel.AddRemoteEvent("Client_AddNetPlayer", R_AddNetPlayer); channel.AddRemoteEvent("Client_RemoveNetPlayer", R_RemoveNetPlayer); channel.AddRemoteEvent("Client_AddInitialNetPlayers", R_AddInitialNetPlayers); }
public MPWorld(MasterRenderer renderer) : base(renderer) { players = new Dictionary <ushort, ClientPlayer>(); physEntities = new Dictionary <ushort, GameObject>(); TimeOfDay = 10; // Grab network components and the world channel client = AOSClient.Instance; snapshotComponent = client.GetComponent <SnapshotNetComponent>(); objectComponent = client.GetComponent <ObjectNetComponent>(); channel = client.GetChannel(AOSChannelType.World); // Add remotes channel.AddRemoteEvent("Client_ThrowGrenade", R_ThrowGrenade); channel.AddRemoteEvent("Client_ShootMelon", R_ShootMelon); channel.AddRemoteEvent("Client_ServerImpact", R_ServerImpact); channel.AddRemoteEvent("Client_RolledBackServerPlayer", R_RolledBackServerPlayer); // Hook into component events objectComponent.OnCreatableInstantiated += ObjectComponent_OnCreatableInstantiated; objectComponent.OnCreatableDestroyed += ObjectComponent_OnCreatableDestroyed; snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound; }
public override void Initialize() { snapshotComponent = client.GetComponent <SnapshotNetComponent>(); snapshotComponent.OnWorldSnapshotInbound += SnapshotComponent_OnWorldSnapshotInbound; base.Initialize(); }