Example #1
0
        public MelonLauncher(ItemManager itemManager, MasterRenderer renderer)
            : base(renderer, itemManager, ItemType.MelonLauncher)
        {
            ModelOffset      = new Vector3(-3.15f, -4f, 0.5f);
            aimModelOffset   = new Vector3(-0.75f, -2.35f, -6f);
            ThirdpersonScale = 0.7f;

            fovAnim   = new FloatAnim();
            modelAnim = new Vector3Anim();

            LoadModel("Models/melon-launcher.aosm");

            if (!GlobalNetwork.IsServer)
            {
                if (!itemManager.IsReplicated)
                {
                    AudioBuffer throwAudioBuffer = AssetManager.LoadSound("Weapons/Grenade/throw.wav");

                    if (throwAudioBuffer != null)
                    {
                        throwAudioSource = new AudioSource(throwAudioBuffer);
                        throwAudioSource.IsSourceRelative = true;
                        throwAudioSource.Pitch            = 1.5f;
                        throwAudioSource.Gain             = 0.2f;
                    }
                }
            }
        }
Example #2
0
        public Gun(ItemManager itemManager, MasterRenderer renderer)
            : base(renderer, itemManager, ItemType.Gun)
        {
            CurrentMag = GunConfig.MagazineSize;
            StoredAmmo = GunConfig.MagazineSize * GunConfig.MaxStoredMags;

            if (GlobalNetwork.IsClient && GlobalNetwork.IsConnected)
            {
                ServerMag        = (ushort)CurrentMag;
                ServerStoredAmmo = (ushort)StoredAmmo;
            }

            fovAnim     = new FloatAnim();
            modelAnim   = new Vector3Anim();
            muzzleFlash = itemManager.GetMuzzleFlash();

            if (!GlobalNetwork.IsServer)
            {
                if (itemManager.IsReplicated)
                {
                    if (GunConfig.PrimaryFireAudio?.ReplicatedFilepath != null)
                    {
                        fireAudioSource = LoadAudioFromConfig(GunConfig.PrimaryFireAudio, replicated: true, far: false);
                    }

                    if (GunConfig.PrimaryFireAudio?.FarFilepath != null)
                    {
                        fireFarAudioSource = LoadAudioFromConfig(GunConfig.PrimaryFireAudio, replicated: true, far: true);
                    }

                    if (GunConfig.ReloadAudio?.ReplicatedFilepath != null)
                    {
                        reloadAudioSource = LoadAudioFromConfig(GunConfig.ReloadAudio, replicated: true);
                    }
                }
                else
                {
                    if (GunConfig.PrimaryFireAudio?.LocalFilepath != null)
                    {
                        fireAudioSource = LoadAudioFromConfig(GunConfig.PrimaryFireAudio);
                    }

                    if (GunConfig.ReloadAudio?.LocalFilepath != null)
                    {
                        reloadAudioSource = LoadAudioFromConfig(GunConfig.ReloadAudio);
                    }

                    AudioBuffer dryFireBuffer = AssetManager.LoadSound("Weapons/dry-fire.wav");

                    if (dryFireBuffer != null)
                    {
                        dryFireAudioSource = new AudioSource(dryFireBuffer);
                        dryFireAudioSource.IsSourceRelative = true;
                        dryFireAudioSource.Gain             = 0.5f;
                    }
                }
            }
        }
Example #3
0
        public CameraFX(Player player, Camera camera)
        {
            this.player = player;
            this.camera = camera;

            offsetAnim      = new Vector3Anim();
            shakeFactorAnim = new FloatAnim();
            rollAnim        = new FloatAnim();
        }
        public MultiplayerLoadingBar(GUISystem system, GUITheme theme)
            : base(system, new UDim2(0.8f, 0, 0, 120), "", theme, false)
        {
            IsDraggable = false;

            barAnim  = new FloatAnim();
            byteAnim = new FloatAnim();

            statusLabel = new GUILabel(new UDim2(0.5f, 0, 0.4f, 0), UDim2.Zero, "0/0 bytes", theme);
            bar         = new GUIFrame(new UDim2(0, 5, 1f, -35), new UDim2(0, -10, 0, 30), Image.Blank);

            AddTopLevel(statusLabel, bar);
        }
Example #5
0
        public ItemViewbob(Player player)
        {
            this.player = player;

            bobAnim      = new Vector3Anim();
            tiltAnim     = new FloatAnim();
            swayAnim     = new Vector3Anim();
            kickbackAnim = new FloatAnim();

            lastYaw   = Camera.Active.Yaw;
            lastPitch = Camera.Active.Pitch;

            cc = player.GetComponent <CharacterController>();
        }
        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);
        }