Пример #1
0
        public override void Init()
        {
            vida = 100;
            sprintTime = 0;
            tiredTime = 0;
            running = false;

            hitSound = new TgcStaticSound();
            breathSound = new TgcStaticSound();
            walkSound = new TgcStaticSound();
            runSound = new TgcStaticSound();

            sniper = new Sniper();
            sniper.Init();
            launcher = new RocketLauncher();
            launcher.Init();

            weapon = sniper;
            weapon.muzzle.scale = weapon.scaleMuzzle;

            //Mesh auxiliar para el sonido
            TgcSceneLoader loader = new TgcSceneLoader();
            TgcScene scene2 = loader.loadSceneFromFile(GuiController.Instance.AlumnoEjemplosMediaDir + "Los_Borbotones\\Meshes\\svd\\svd-TgcScene.xml");
            meshAuxiliarParaSonido = scene2.Meshes[0];

            //hago que los 3dSound sigan al arma
            GuiController.Instance.DirectSound.ListenerTracking = meshAuxiliarParaSonido;
            ///////////////CONFIGURAR CAMARA PRIMERA PERSONA CUSTOM//////////////////
            //Camara en primera persona, tipo videojuego FPS
            //Solo puede haber una camara habilitada a la vez. Al habilitar la camara FPS se deshabilita la camara rotacional
            //Por default la camara FPS viene desactivada
            GuiController.Instance.RotCamera.Enable = false;
            CustomFpsCamera.Instance.Enable = true;
            GuiController.Instance.CurrentCamera = CustomFpsCamera.Instance;
            //Configurar posicion y hacia donde se mira
            CustomFpsCamera.Instance.setCamera(new Vector3(0, 930, 0), new Vector3(-400, 930, 0));

            prevEye = CustomFpsCamera.Instance.eye;
            //cargar sonido
            breathSound.loadSound(breathingSoundDir, HUDManager.Instance.PLAYER_VOLUME);
            hitSound.loadSound(hitSoundDir, HUDManager.Instance.PLAYER_VOLUME);
            //reproducir sonido de respawn
            playSound(walkSound, walkSoundDir, true);
            playSound(runSound, runSoundDir, true);
            runSound.stop();
            walkSound.stop();
        }
Пример #2
0
 public void refreshMainWeapon()
 {
     Weapon MainWeapon = GameManager.Instance.player1.weapon;
     if (MainWeapon != prevWeap) {
         if (MainWeapon.Equals(GameManager.Instance.player1.sniper))
         {
             hudWeapon.Texture = sniperTexture;
             prevWeap = GameManager.Instance.player1.sniper;
         }
         else
         {
             hudWeapon.Texture = launcherTexture;
             prevWeap = GameManager.Instance.player1.launcher;
         }
     }
 }