Ejemplo n.º 1
0
 private void PlayClick()
 {
     if (audioElement != null)
     {
         audioElement.Play(clickSound);
     }
 }
 protected virtual void HandleButton(string text)
 {
     if (audioElement != null)
     {
         audioElement.Play(clickSound);
     }
 }
Ejemplo n.º 3
0
    // 1. Play
    public static AudioElement PlayElement(string name, PlaySettings playSettings)
    {
        AudioElement e = GetElement(name);

        e.Play(playSettings);
        return(e);
    }
Ejemplo n.º 4
0
 protected virtual void HandleButton(string text)
 {
     if (audioElement != null)
     {
         audioElement.Play(clickSound);
     }
     //a child class needs to set this to handle button clicks
 }
Ejemplo n.º 5
0
 protected virtual void HandleButton(string text)
 {
     //child class needs to handle buttons here
     if (audioElement != null)
     {
         audioElement.Play(clickSound);
     }
 }
Ejemplo n.º 6
0
 protected virtual void BeginAttack(WorldObject target)
 {
     if (audioElement != null)
     {
         audioElement.Play(attackSound);
     }
     this.target = target;
     if (TargetInRange())
     {
         attacking = true;
         PerformAttack();
     }
     else
     {
         AdjustPosition();
     }
 }
Ejemplo n.º 7
0
    public void PlayAudio()
    {
        _audio.Play(_source);

        if (_destroyAfterPlay)
        {
            StartCoroutine(Destroy());
        }
    }
Ejemplo n.º 8
0
        protected override void Init()
        {
#if DEBUG
            if (Current != null)
            {
                throw Exception.Create("Cannot have more than one ShooterLevel running at the same time!", null);
            }
#endif
            pendingTimers = new List <int>();

            if (jQuery.Browser.Mozilla)
            {
                _music = LoadAudio("Audio/boss.ogg");
            }
            else
            {
                _music = LoadAudio("Audio/boss.mp3");
            }

            Current          = this;
            Status           = ShooterStatus.Starting;
            BaseSpeed        = 0.05f;
            _backgroundImage = LoadImage("Images/shooter/bg.png", false);
            AddSystem(new CloudSystem());
            AddSystem(Meteor    = new MeteorSystem());
            AddSystem(Buildings = new BuildingSystem(700, _length, 3));
            AddSystem(Dinos     = new DinosSystem(_length));
            AddSystem(_weapons  = new WeaponsSystem());
            AddSystem(Plasma    = new PlasmaSystem());
            AddSystem(Bonus     = new BonusSystem());

            ShowMessage(_startMessage);
            Window.SetTimeout(delegate()
            {
                HideMessage();
                Status = ShooterStatus.Running;
                _music.Play();

                _music.AddEventListener("ended", delegate(ElementEvent e) { _music.Play(); }, false);
            }, 3000);
        }
Ejemplo n.º 9
0
        //void audio_MediaFailed(object sender, ExceptionRoutedEventArgs e)
        //{
        //    audio.Stop();
        //}


        public override void Play()
        {
            if (audio == null)
            {
                InitializeTexture();
            }
            if (audio != null && audioReady)
            {
                audio.Play();
                Volume = Volume;
            }
        }
Ejemplo n.º 10
0
    private void OnCollisionEnter2D(Collision2D other)
    {
        if (_isInvincible.Value)
        {
            return;
        }

        var enemy = other.gameObject.GetComponent <Enemy>();

        if (enemy == null)
        {
            return;
        }

        TakeDamage(enemy.DamageAmount);
        _hitAudio.Play(_audioSource);
        _isInvincible.Value = true;
    }
Ejemplo n.º 11
0
    private void Dash()
    {
        if (_direction == Vector3.zero)
        {
            return;
        }

        if (!Input.GetKeyDown(KeyCode.Space))
        {
            return;
        }

        _audioElement.Play(_audioSource);
        var dashObject = Instantiate(_dashParticleSystem);

        dashObject.transform.position = transform.position;
        _isDashing = true;
    }
Ejemplo n.º 12
0
        //public AudioOverlay(RenderContext renderContext, TourStop owner, string filename)
        //{
        //    isDesignTimeOnly = true;
        //    X = 0;
        //    Y = 0;
        //    this.filename = Guid.NewGuid().ToString() + filename.Substr(filename.LastIndexOf("."));
        //    this.Owner = owner;
        //    this.Name = owner.GetNextDefaultName("Audio");
        //    // File.Copy(filename, Owner.Owner.WorkingDirectory + this.filename);
        //}

        public override void InitializeTexture()
        {
            if (audio == null)
            {
                audio = (AudioElement)Document.CreateElement("audio");
                //audio.AutoPlay = true;
                //audio.MediaFailed += new EventHandler<ExceptionRoutedEventArgs>(audio_MediaFailed);
                //audio.MediaOpened += new RoutedEventHandler(audio_MediaOpened);
                //Viewer.MasterView.audio.Children.Add(audio);
                audio.Src = Owner.Owner.GetFileStream(this.filename);
                audio.AddEventListener("canplaythrough", delegate
                {
                    audioReady = true;
                    audio_MediaOpened();
                    audio.Play();
                }, false);
            }
        }
Ejemplo n.º 13
0
 public void PitchListener(object source, int interval, int octave)
 {
     pitchSequence.Add(myScale.GetNote(interval, octave));
     myElement.Play(new PlaySettings(metronome, snapStyle, snapValue, RandomDelay(), false, 0f, FadeType.Lin, 1f));
 }