Exemple #1
0
        public override void OnNetworkInstantiated(NetCreatableInfo stateInfo)
        {
            base.OnNetworkInstantiated(stateInfo);

            SnapshotNetComponent snc = AOSServer.Instance.GetComponent <SnapshotNetComponent>();

            ClientSnapshot = new ClientPlayerSnapshot(snc.SnapshotSystem, stateInfo.Owner, true);
        }
        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);
        }