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 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);
        }
Ejemplo n.º 3
0
        public SPPlayer(MasterRenderer renderer, World world, Camera camera, Vector3 position, Team team)
            : base(renderer, world, camera, position, team)
        {
            this.camera         = camera;
            camfx               = new CameraFX(this, camera);
            camera.SmoothCamera = true;

            startLocation = position;

            ItemManager.SetItems(new Item[]
            {
                new Rifle(ItemManager, renderer),
                new SMG(ItemManager, renderer),
                new Shotgun(ItemManager, renderer),
                new Grenade(ItemManager, renderer),
                new Spade(ItemManager, renderer),
                new BlockItem(ItemManager, renderer),
                new MelonLauncher(ItemManager, renderer)
            }, 5);

            NumMelons = MAX_MELONS;

            CharacterController.OnCollision += CharacterController_OnCollision;

            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);
        }