public static void UpdateForLander02()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    Globals.SelectedShip.VerticalVelocity -= (Globals.SelectedShip.Accel * 2);
                }
                SoundClass.PlayLooping(Globals.SFXRocketInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown || Globals.SpaceKeyDown);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, Globals.UpKeyDown || Globals.SpaceKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, Globals.LeftKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, Globals.RightKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, Globals.DownKeyDown, false);
            }
            else
            {
                SoundClass.Stop(Globals.SFXRocketInstance);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, false, false);
            }

            if (Globals.SpaceKeyDown && !Globals.SpaceKeyDownPrevious)
            {
                Globals.SelectedShip.SpriteBotton.TextureCurrent = Globals.SelectedShip.SpriteBotton.Textures[1];
            }
            else if (!Globals.SpaceKeyDown && Globals.SpaceKeyDownPrevious)
            {
                Globals.SelectedShip.SpriteBotton.TextureCurrent = Globals.SelectedShip.SpriteBotton.Textures[0];
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Resume playing the paused sounds of the given Sound Class.
 /// </summary>
 /// <param name="soundClass">The Sound Class to resume playing.</param>
 public void ResumeSoundClass(SoundClass soundClass)
 {
     if (MediaPlayer.State == MediaState.Paused)
     {
         MediaPlayer.Resume();
     }
     if (soundClass == SoundClass.Effect)
     {
         for (int i = 0; i <= mEffectInstanceId; i++)
         {
             if (mEffectInstances.ContainsKey(i))
             {
                 if (mEffectInstances[i].State == SoundState.Paused)
                 {
                     mEffectInstances[i].Play();
                 }
             }
         }
     }
     if (soundClass == SoundClass.Ui)
     {
         for (int i = 0; i <= mUiInstanceId; i++)
         {
             if (mUiInstances.ContainsKey(i))
             {
                 if (mUiInstances[i].State == SoundState.Paused)
                 {
                     mUiInstances[i].Play();
                 }
             }
         }
     }
 }
        public static void UpdateForLander03()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    Globals.SelectedShip.Accel = (Functions.ConvertMpSToVelocity(Globals.SelectedShip.AccelMpS, Globals.TimerInterval, Globals.PixelToMeter) / 2);
                }
                else
                {
                    Globals.SelectedShip.Accel = Functions.ConvertMpSToVelocity(Globals.SelectedShip.AccelMpS, Globals.TimerInterval, Globals.PixelToMeter);
                }

                SoundClass.PlayLooping(Globals.SFXRocketInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, Globals.UpKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, Globals.LeftKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, Globals.RightKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, Globals.DownKeyDown, false);
            }
            else
            {
                SoundClass.Stop(Globals.SFXRocketInstance);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, false, false);
            }
        }
Esempio n. 4
0
 /// <summary>
 /// Stopping all the currently playing sounds of a given class.
 /// </summary>
 /// <param name="soundClass">The class to be stopped.</param>
 public void StopSoundClass(SoundClass soundClass)
 {
     if (soundClass == SoundClass.Music)
     {
         if (MediaPlayer.State == MediaState.Playing)
         {
             MediaPlayer.Stop();
         }
     }
     else if (soundClass == SoundClass.Effect)
     {
         for (int i = 0; i <= mEffectInstanceId; i++)
         {
             if (mEffectInstances.ContainsKey(i))
             {
                 mEffectInstances[i].Stop();
             }
         }
     }
     else if (soundClass == SoundClass.Ui)
     {
         for (int i = 0; i <= mEffectInstanceId; i++)
         {
             if (mUiInstances.ContainsKey(i))
             {
                 mUiInstances[i].Stop();
             }
         }
     }
 }
Esempio n. 5
0
        /// <summary>
        /// Change the position of a 3D sound effect instance.
        /// </summary>
        /// <param name="id">The gloabl id of the sound effect instance.</param>
        /// <param name="x">The new x coordinate.</param>
        /// <param name="y">The new y coordinate.</param>
        internal void SetSoundPosition(int id, float x, float y)
        {
            var newX = x / 120;
            var newY = y / 120;

            if (mInstanceMap.ContainsKey(id))
            {
                SoundClass soundClass = mInstanceMap[id].Item1;
                int        instanceId = mInstanceMap[id].Item2;
                if (soundClass == SoundClass.Effect)
                {
                    AudioEmitter emitter = new AudioEmitter {
                        Position = new Vector3(newX, newY, 0)
                    };
                    mEffectInstances[instanceId].Apply3D(mListener, emitter);
                }
                else if (soundClass == SoundClass.Ui)
                {
                    AudioEmitter emitter = new AudioEmitter {
                        Position = new Vector3(newX, newY, 0)
                    };
                    mUiInstances[instanceId].Apply3D(mListener, emitter);
                }
            }
        }
        public static void UpdateForLander05()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    Functions.ApplyDrag(Globals.SelectedShip.Accel * 2, Globals.SelectedShip, Enum.Axis.Vertical);
                }

                SoundClass.PlayLooping(Globals.SFXRocketInstance, Globals.UpKeyDown || Globals.LeftKeyDown || Globals.RightKeyDown || Globals.DownKeyDown || Globals.SpaceKeyDown);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, Globals.UpKeyDown || Globals.SpaceKeyDown || Globals.LeftKeyDown || Globals.RightKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, Globals.DownKeyDown, false);
            }
            else
            {
                SoundClass.Stop(Globals.SFXRocketInstance);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, false, false);
            }

            if (!Globals.LeftKeyDown && !Globals.RightKeyDown && (Globals.LeftKeyDownPrevious || Globals.RightKeyDownPrevious))
            {
                Globals.SelectedShip.TextureCurrent = Globals.SelectedShip.Textures[0];
            }
            else if (Globals.LeftKeyDown && !Globals.LeftKeyDownPrevious)
            {
                Globals.SelectedShip.TextureCurrent = Globals.SelectedShip.Textures[3];
            }
            else if (Globals.RightKeyDown && !Globals.RightKeyDownPrevious)
            {
                Globals.SelectedShip.TextureCurrent = Globals.SelectedShip.Textures[4];
            }
        }
Esempio n. 7
0
    public void randoPlay(string name)
    {
        SoundClass s = Array.Find(sounds, sound => sound.name == name);

        s.source.pitch = Random.Range(s.pitch - 0.1f, s.pitch + 0.1f);
        s.source.Play();
    }
        public static void UpdateForLander01()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    Functions.ApplyDrag(Globals.SelectedShip.Accel * 2, Globals.SelectedShip, Enum.Axis.All);
                }

                SoundClass.PlayLooping(Globals.SFXRocketInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown || Globals.SpaceKeyDown);

                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, Globals.UpKeyDown || Globals.SpaceKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, Globals.LeftKeyDown || Globals.SpaceKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, Globals.RightKeyDown || Globals.SpaceKeyDown, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, Globals.DownKeyDown || Globals.SpaceKeyDown, false);
            }
            else
            {
                SoundClass.Stop(Globals.SFXRocketInstance);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteBotton, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteRight, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteLeft, false, false);
                Functions.ApplyFlicker(Globals.SelectedShip.SpriteTop, false, false);
            }
        }
        /// <summary>
        /// Blendet die Form langsam ein
        /// </summary>
        public void showForm()
        {
            double i;

            this.Opacity = 0.1;
            this.Visible = true;

            // Intervall
            i = 0.03;
            // Sound asynchron laden und wiedergeben
            SoundClass soundPlayer = new SoundClass();
            soundPlayer.playSoundAsync(soundPlayer.currentSoundDir + "\\yaarrr.wav");

            // Solange durchlaufen bis Opacity = 1 (100%)
            while (this.Opacity < 1)
            {
                System.Threading.Thread.Sleep(25);
                // Opacity erhöhen
                this.Opacity += i;
                this.TopMost = true;
                Application.DoEvents();
            }
            this.TopMost = false;
            this.BringToFront();
            Application.DoEvents();
        }
Esempio n. 10
0
        public SoundContext ToSoundContext(CogProject project, SegmentPool segmentPool)
        {
            IWordAligner aligner  = project.WordAligners[ComponentIdentifiers.PrimaryWordAligner];
            SoundClass   leftEnv  = LeftEnvironment == null ? null : aligner.ContextualSoundClasses.First(sc => sc.Name == LeftEnvironment);
            SoundClass   rightEnv = RightEnvironment == null ? null : aligner.ContextualSoundClasses.First(sc => sc.Name == RightEnvironment);

            return(new SoundContext(leftEnv, new Ngram <Segment>(_target.Select(segmentPool.GetExisting)), rightEnv));
        }
Esempio n. 11
0
    public void FadeOut(string _name, float time)
    {
        SoundClass soundClass = Array.Find(sounds, sound => sound.name == _name);

        if (soundClass != null)
        {
            StartCoroutine(FadeOutSound(soundClass, time));
        }
    }
Esempio n. 12
0
    //Call this function through other script
    //e.g AudioManager.instance.PlaySound("CannonImpact");
    public void PlaySound(string _name)
    {
        SoundClass soundClass = Array.Find(sounds, sound => sound.name == _name);

        if (soundClass == null)
        {
            Debug.LogWarning("Sound: " + _name + " not found.");
            return;
        }

        if (Time.time > soundClass.nextPlayTime)
        {
            soundClass.canPlay = true;
        }

        if (soundClass.audioClip.Length > 1)
        {
            if (soundClass.canPlay)
            {
                if (soundClass.music)
                {
                    soundClass.audioSource.PlayOneShot(soundClass.audioClip[UnityEngine.Random.Range(0, soundClass.audioClip.Length)], soundClass.volume * musicLevel);
                }
                else
                {
                    soundClass.audioSource.PlayOneShot(soundClass.audioClip[UnityEngine.Random.Range(0, soundClass.audioClip.Length)], soundClass.volume * soundLevel);
                }


                soundClass.canPlay = false;

                soundClass.nextPlayTime = Time.time + soundClass.coolDown;
            }
        }
        else if (soundClass.audioClip.Length > 0)
        {
            if (soundClass.canPlay)
            {
                if (soundClass.music)
                {
                    soundClass.audioSource.PlayOneShot(soundClass.audioClip[0], soundClass.volume * musicLevel);
                }
                else
                {
                    soundClass.audioSource.PlayOneShot(soundClass.audioClip[0], soundClass.volume * soundLevel);
                }

                soundClass.canPlay = false;

                soundClass.nextPlayTime = Time.time + soundClass.coolDown;
            }
        }
        else
        {
            Debug.LogError("No sound was played");
        }
    }
Esempio n. 13
0
    public void FadeInMusic(string _name, float time)
    {
        SoundClass soundClass = Array.Find(sounds, sound => sound.name == _name);

        if (soundClass != null)
        {
            PlaySound(_name);
            StartCoroutine(FadeInSound(soundClass, time));
        }
    }
Esempio n. 14
0
 private void SetImageIndInfo()
 {
     if (TutWithImages.Count <= CurrentIdx)
     {
         return;
     }
     textBlock.Text = TutWithImages[CurrentIdx].TutorialText;
     image.Source   = ConvertToImageSource(TutWithImages[CurrentIdx].TutorialImage);
     SoundClass.PlayPS4Sound(SoundClass.Sound.Navigation);
 }
Esempio n. 15
0
    public void Play(string name)
    {
        SoundClass s = Array.Find(sounds, sound => sound.name == name);

        if (s == null)
        {
            Debug.LogWarning("Sound " + name + " not found!");
        }
        s.source.Play();
    }
Esempio n. 16
0
    public void Stop(string clipName)
    {
        SoundClass s = Array.Find(sounds, sound => sound.clipName == clipName);

        if (s == null)
        {
            Debug.LogWarning("Clip: " + clipName + " not found. Check the name");
            return;
        }
        s.source.Stop();
    }
Esempio n. 17
0
    public void play(string name)                                                  //Play audio by name
    {
        SoundClass s = Array.Find(musicList, musicList => musicList.name == name); //Find the sound

        if (s == null)
        {
            Debug.LogWarning(name + "Not Found!"); //Warning if sound not found
            return;
        }
        s.source.Play(); //Play the sound
    }
Esempio n. 18
0
	// Use this for initialization
	void Start ()
    {

        ItsAThing = GetComponent<SoundClass>();
        //print(ResumedTrack);
        
        ItsAThing.SetAudioObject();
        
        GetComponent<SoundClass>().PlayResumedSound(ResumedTrack, true);

        //GetComponent<SoundClass>().PlayClassSound();
    }
Esempio n. 19
0
        public static void ApplyPostStage()
        {
            SoundClass.Stop(Globals.SFXRocketInstance);
            SoundClass.Stop(Globals.SFXFloatInstance);

            if (Globals.EnterKeyPressed)
            {
                if (Globals.GameType == Enum.GameType.Arcade)
                {
                    if (Globals.Landed)
                    {
                        FunctionsGame.ChangeStage();
                    }
                    else if (Globals.Collided)
                    {
                        if (Globals.ShipsLeft > 0)
                        {
                            Globals.ShipsLeft--;
                            FunctionsStage.InitializeStage();
                        }
                        else
                        {
                            Globals.CurrentScene = new Scenes.SceneTitle();
                        }
                    }
                }
                else if (Globals.GameType == Enum.GameType.OreColleting)
                {
                    if (Globals.Landed)
                    {
                        if (!Globals.SelectedStage.SpriteRedOre.Visible && !Globals.SelectedStage.SpriteGreenOre.Visible && !Globals.SelectedStage.SpriteBlueOre.Visible)
                        {
                            Globals.OreCollected = true;
                            FunctionsGame.RecordFeatures(Enum.RecordType.OreCollected);
                            Globals.CurrentScene = new Scenes.SceneChooseStage();
                        }
                        else
                        {
                            FunctionsStage.InitializeStage();
                        }
                    }
                    else
                    {
                        FunctionsStage.InitializeStage();
                    }
                }
                else
                {
                    FunctionsStage.InitializeStage();
                }
            }
        }
    // baraye ziyad kardan volume estefade misgavad
    public void MusicVolumeUp(string name)
    {
        // araye haye sounds o begard va name marboote ra peyda kon be dakhel moteghayer s ke too class soundclass ast beriz
        SoundClass s = Array.Find(sounds, sound => sound.name == name);

        // agar string name eshteba vared shavad etefaghi nayoftad
        if (s == null)
        {
            return;
        }

        s.source.volume = 1f;
    }
Esempio n. 21
0
    private IEnumerator FadeInSound(SoundClass _sound, float time)
    {
        float speed   = 1 / time;
        float percent = 0;

        while (percent < 1)
        {
            percent += Time.deltaTime * speed;
            _sound.audioSource.volume = Mathf.Lerp(0, 1, percent);

            yield return(null);
        }
    }
Esempio n. 22
0
    /// <summary>
    /// Modified Play method with functionality of stopping certain sound, on same way as Play.
    /// Logs case if source with specified name not found.
    /// </summary>
    /// <param name="name"> Name of the source playing the clip, desired to be turned off. </param>
    public void Stop(string name)
    {
        SoundClass s = Array.Find(sounds, sound => sound.Name == name);

        if (s != null)
        {
            s.source.Stop();
        }
        else
        {
            Debug.Log("Sound " + name + " not found");
        }
    }
    public void Stop(string name)
    {
        // araye haye sounds o begard va name marboote ra peyda kon be dakhel moteghayer s ke too class soundclass ast beriz
        SoundClass s = Array.Find(sounds, sound => sound.name == name);

        // agar string name eshteba vared shavad etefaghi nayoftad
        if (s == null)
        {
            return;
        }

        // har moghe dar morede sound E ke name ash avarde mishavad dastoor stop kardan ra ejra kon
        s.source.Stop();
    }
Esempio n. 24
0
    public void StopPlaying(string sound)
    {
        SoundClass s = Array.Find(sounds, item => item.name == sound);

        if (s == null)
        {
            Debug.LogWarning("Sound: " + name + " not found!");
            return;
        }

        s.source.volume = s.volume * (1f + UnityEngine.Random.Range(-s.volume / 2f, s.volume / 2f));
        s.source.pitch  = s.pitch * (1f + UnityEngine.Random.Range(-s.pitch / 2f, s.pitch / 2f));

        s.source.Stop();
    }
Esempio n. 25
0
 /// <summary>
 /// Stops the playback of an individual sound - SFX or UI.
 /// </summary>
 /// <param name="id">The id of the sound to be stopped.</param>
 public void StopSound(int id)
 {
     if (mInstanceMap.ContainsKey(id))
     {
         SoundClass soundClass = mInstanceMap[id].Item1;
         if (soundClass == SoundClass.Effect)
         {
             mEffectInstances[mInstanceMap[id].Item2].Stop();
         }
         else if (soundClass == SoundClass.Ui)
         {
             mUiInstances[mInstanceMap[id].Item2].Stop();
         }
     }
 }
Esempio n. 26
0
 /// <summary>
 /// Sets the volume of the sound effect instance specified by the given id.
 /// </summary>
 /// <param name="id">The global sound instance id.</param>
 /// <param name="volume">The desired volume.</param>
 public void SetSoundVolume(int id, float volume)
 {
     if (mInstanceMap.ContainsKey(id))
     {
         SoundClass soundClass = mInstanceMap[id].Item1;
         int        instanceId = mInstanceMap[id].Item2;
         if (soundClass == SoundClass.Effect)
         {
             mEffectInstances[instanceId].Volume = volume;
         }
         else if (soundClass == SoundClass.Ui)
         {
             mUiInstances[instanceId].Volume = volume;
         }
     }
 }
Esempio n. 27
0
 /// <summary>
 /// Set the pitch of a sound effect instance.
 /// </summary>
 /// <param name="id">The gloabl id of the sound effect instance.</param>
 /// <param name="pitch">The new pitch.</param>
 public void SetSoundPitch(int id, float pitch)
 {
     if (mInstanceMap.ContainsKey(id))
     {
         SoundClass soundClass = mInstanceMap[id].Item1;
         int        instanceId = mInstanceMap[id].Item2;
         if (soundClass == SoundClass.Effect)
         {
             mEffectInstances[instanceId].Pitch = pitch;
         }
         else if (soundClass == SoundClass.Ui)
         {
             mUiInstances[instanceId].Pitch = pitch;
         }
     }
 }
Esempio n. 28
0
        public static void UpdateForLander06()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown && !Globals.SpaceKeyDownPrevious)
                {
                    Globals.SelectedShip.HorizontalVelocity *= -0.3F;
                    Globals.SelectedShip.VerticalVelocity   *= -0.3F;
                }

                SoundClass.PlayLooping(Globals.SFXFloatInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown);
            }
            else
            {
                SoundClass.Stop(Globals.SFXFloatInstance);
            }
        }
Esempio n. 29
0
        internal static XElement SaveSoundClass(SoundClass soundClass)
        {
            var nc = soundClass as NaturalClass;

            if (nc != null)
            {
                return(new XElement(Cog + "NaturalClass", new XAttribute("name", nc.Name),
                                    new XAttribute("type", nc.Type == CogFeatureSystem.VowelType ? "vowel" : "consonant"), CreateFeatureStruct(nc.FeatureStruct)));
            }
            var unc = soundClass as UnnaturalClass;

            if (unc != null)
            {
                return(new XElement(Cog + "UnnaturalClass", new XAttribute("name", unc.Name), new XAttribute("ignoreModifiers", unc.IgnoreModifiers),
                                    unc.Segments.Select(s => new XElement(Cog + "Segment", s))));
            }
            return(null);
        }
Esempio n. 30
0
        public IProcessor <Variety> Load(SpanFactory <ShapeNode> spanFactory, SegmentPool segmentPool, CogProject project, XElement elem)
        {
            var      combineVowels = (bool?)elem.Element(ConfigManager.Cog + "CombineVowels") ?? true;
            var      combineCons   = (bool?)elem.Element(ConfigManager.Cog + "CombineConsonants") ?? true;
            var      vowelsSameSonorityTautosyllabic = (bool?)elem.Element(ConfigManager.Cog + "VowelsSameSonorityTautosyllabic") ?? false;
            XElement scaleElem = elem.Element(ConfigManager.Cog + "SonorityScale");

            Debug.Assert(scaleElem != null);
            var sonorityScale = new List <SonorityClass>();

            foreach (XElement scElem in scaleElem.Elements(ConfigManager.Cog + "SonorityClass"))
            {
                var        sonority   = (int)scElem.Attribute("sonority");
                SoundClass soundClass = ConfigManager.LoadSoundClass(project.Segmenter, project.FeatureSystem, scElem.Elements().First());
                sonorityScale.Add(new SonorityClass(sonority, soundClass));
            }
            return(new SspSyllabifier(combineVowels, combineCons, vowelsSameSonorityTautosyllabic, segmentPool, sonorityScale));
        }
Esempio n. 31
0
        public static void UpdateForLander04()
        {
            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    Globals.SelectedShip.VerticalVelocity   = 0;
                    Globals.SelectedShip.HorizontalVelocity = 0;
                }

                SoundClass.PlayLooping(Globals.SFXSpecialInstance, Globals.SpaceKeyDown);
                SoundClass.PlayLooping(Globals.SFXFloatInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown);
            }
            else
            {
                SoundClass.Stop(Globals.SFXFloatInstance);
                SoundClass.Stop(Globals.SFXSpecialInstance);
            }
        }
Esempio n. 32
0
        public static void UpdateForLanderX1()
        {
            SoundClass.PlayLooping(Globals.SFXSpecialInstance, Globals.SpaceKeyDown);

            if (Globals.SelectedShip.Fuel > 0)
            {
                if (Globals.SpaceKeyDown)
                {
                    //Cancela acelerações atribuidas
                    if (Globals.LeftKeyDown)
                    {
                        Globals.SelectedShip.HorizontalVelocity += Globals.SelectedShip.Accel;
                        Globals.SelectedShip.Fuel += Globals.SelectedShip.FuelConsumptionRate;
                    }
                    else if (Globals.RightKeyDown)
                    {
                        Globals.SelectedShip.HorizontalVelocity -= Globals.SelectedShip.Accel;
                        Globals.SelectedShip.Fuel += Globals.SelectedShip.FuelConsumptionRate;
                    }

                    if (Globals.UpKeyDown)
                    {
                        Globals.SelectedShip.VerticalVelocity += Globals.SelectedShip.Accel;
                        Globals.SelectedShip.Fuel             += Globals.SelectedShip.FuelConsumptionRate;
                    }
                    else if (Globals.DownKeyDown)
                    {
                        Globals.SelectedShip.VerticalVelocity -= Globals.SelectedShip.Accel;
                        Globals.SelectedShip.Fuel             += Globals.SelectedShip.FuelConsumptionRate;
                    }
                }

                SoundClass.PlayLooping(Globals.SFXFloatInstance, Globals.LeftKeyDown || Globals.RightKeyDown || Globals.UpKeyDown || Globals.DownKeyDown);
            }
            else
            {
                SoundClass.Stop(Globals.SFXFloatInstance);
            }
        }
        /// <summary>
        /// Konstruktor der Spieloberfläche
        /// </summary>
        public BattleshipsForm()
        {
            try
            {
                InitializeComponent();

                // Spieler ist noch nicht bereit (Start des Spiels)
                playerReady2Play = false;
                opponendReady2Play = false;

                lanMenuItem = new ToolStripMenuItem("&Netzwerk");
                spielBeitretenMenuItem = new ToolStripMenuItem("&Spiel beitreten");
                spielHostenMenuItem = new ToolStripMenuItem("Spiel &hosten");
                helpMenuItem = new ToolStripMenuItem("?");
                infoMenuItem = new ToolStripMenuItem("&Info");

                spielBeitretenMenuItem.Click += new EventHandler(spielBeitretenToolStripMenuItem_Click);
                spielHostenMenuItem.Click += new EventHandler(spielHostenToolStripMenuItem_Click);
                infoMenuItem.Click += new EventHandler(infoMenuItem_Click);

                panelStatus = new Panel();
                panelStatus.Location = new Point(597, 47);
                panelStatus.Size = new System.Drawing.Size(197, 100);
                panelStatus.AutoScroll = true;
                panelStatus.BackColor = Color.Transparent;
                panelStatus.VerticalScroll.SmallChange = 50;
                panelStatus.HorizontalScroll.Enabled = true;

                lblStatus = new Label();
                //lblStatus.Dock = DockStyle.Fill;
                lblStatus.TextAlign = ContentAlignment.TopLeft;
                lblStatus.AutoSize = true;
                lblStatus.Font = new System.Drawing.Font("Book Antiqua", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                panelStatus.Controls.Add(lblStatus);

                this.Controls.Add(panelStatus);

                lanMenuItem.DropDownItems.Add(spielHostenMenuItem);
                lanMenuItem.DropDownItems.Add(spielBeitretenMenuItem);
                helpMenuItem.DropDownItems.Add(infoMenuItem);
                menuStripMain.Items.Add(lanMenuItem);
                menuStripMain.Items.Add(helpMenuItem);

                soundPlayer = new SoundClass();

                battlefieldPlayer = new BattlefieldPlayer(BATTLEFIELDPLAYER_X, BATTLEFIELDPLAYER_Y);
                battlefieldOpponent = new BattlefieldOpponent(BATTLEFIELDOPPONNENT_X, BATTLEFIELDOPPONNENT_Y);

                // Schlachtfelder der Hautpform Hinzufügen
                this.Controls.Add(battlefieldPlayer);
                this.Controls.Add(battlefieldOpponent);

                SplashScreen splash = new SplashScreen();
                // Splashscreen anzeigen (langsam einblenden)
                splash.showForm();
                // Splashscreen für 1sek. anzeigen
                Thread.Sleep(1000);
                // Splashscreen schließen
                splash.Close();
                // Ressourcen freigeben
                splash.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message + " " + ex.InnerException.ToString());
            }
        }
Esempio n. 34
0
 public SonorityClass(int sonority, SoundClass soundClass)
 {
     _sonority = sonority;
     _soundClass = soundClass;
 }
Esempio n. 35
0
 void MakeSingleton()
 {
     if (instance != null)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }