Esempio n. 1
0
 void Awake()
 {
     if (sound.instance == null)
     {
         sound.instance = this;
     }
 }
Esempio n. 2
0
 public void Play(string name)
 {
     sound s = Array.Find(sounds, sound => sound.Name == name);
     {
         s.source.Play();
     }
 }
Esempio n. 3
0
 void Start()
 {
     _player = PlayerController();
     _holder = transform;
     _cam    = FindObjectOfType <Camera>();
     _sound  = GetComponent <sound>();
 }
Esempio n. 4
0
    //função para definir cara audio
    public static void playSound(sound currentSound)
    {
        switch (currentSound)
        {
        case sound.firePlayer:
            instance.audio.PlayOneShot(instance.fireP);
            break;

        case sound.explosionPlayer:
            instance.audio.PlayOneShot(instance.explosionP);
            break;

        case sound.fireEnemy:
            instance.audio.PlayOneShot(instance.fireE);
            break;

        case sound.explosionHeavyEnemy:
            instance.audio.PlayOneShot(instance.explosionHE);
            break;

        case sound.explosionLightEnemy:
            instance.audio.PlayOneShot(instance.explosionLE);
            break;

        case sound.explosionProbe:
            instance.audio.PlayOneShot(instance.explosionPro);
            break;
        }
    }
Esempio n. 5
0
    public bool AddSE(AudioClip clip, string name = null)
    {
        for (int i = 0; i < Effectsounds.Count; i++)
        {
            if (Effectsounds[i].name.CompareTo(name) == 0)
            {
                return(false);
            }
        }

        if (clip)
        {
            sound newEffect = new sound();
            newEffect.clip = clip;

            if (name == null)
            {
                newEffect.name = clip.name;
            }
            Effectsounds.Add(newEffect);
            return(true);
        }

        return(false);
    }
Esempio n. 6
0
 void Start()
 {
     _player    = PlayerController();
     _rigidbody = GetComponent <Rigidbody2D>();
     _transform = transform;
     _animator  = GetComponent <Animator>();
     _sound     = GetComponent <sound>();
 }
Esempio n. 7
0
        public ActionResult DeleteConfirmed(int id)
        {
            sound sound = db.sounds.Find(id);

            db.sounds.Remove(sound);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Esempio n. 8
0
    //Boxcast Debug Stuff
    //public Text Ground;
    //public Text Left;
    //public Text Right;

    void Start()
    {
        Forcefield.SetActive(false);
        _player    = PlayerController();
        _animator  = GetComponent <Animator>();
        _rigidbody = GetComponent <Rigidbody2D>();
        _transform = transform;
        _sound     = GetComponent <sound>();
    }
Esempio n. 9
0
    // Start is called before the first frame update
    void Start()
    {
        MainAnimation = this.GetComponent <Animator>();


        Body        = this.GetComponent <Rigidbody>();
        NumberJump  = MaxJump;
        playersound = GetComponent <sound>();
    }
Esempio n. 10
0
 // Start is called before the first frame update
 void Start()
 {
     MainAnimation = this.GetComponent <Animator>();
     MainAnimation.SetInteger("life", Life);
     MainSprite  = this.GetComponent <SpriteRenderer>();
     Body        = this.GetComponent <Rigidbody2D>();
     NumberJump  = MaxJump;
     playersound = GetComponent <sound>();
 }
Esempio n. 11
0
 public ActionResult Edit([Bind(Include = "id_sound,name")] sound sound)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sound).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sound));
 }
    public void Play(string name)
    {
        sound s = Array.Find(sounds, sound => sound.name == name);

        if (s == null)
        {
            return;
        }
        s.source.Play();
    }
Esempio n. 13
0
    public void ChangePitch(string name, float pitch)
    {
        sound s = System.Array.Find(sounds, sound => sound.ClipName == name);

        if (s == null)
        {
            return;
        }
        s.source.pitch = pitch;
    }
Esempio n. 14
0
    public void stopOne(string name)
    {
        sound s = System.Array.Find(sounds, sound => sound.ClipName == name);

        if (s == null)
        {
            return;
        }
        s.source.Stop();
    }
Esempio n. 15
0
 public void ExplosionSFX(int num)
 {
     if (playSFX == true)
     {
         sound ex = explosionFX[num];
         ex.source.Play();
         StartCoroutine(cameraShakeCR.Shake(0.15f, 0.4f));
         Debug.Log("Play Explosion SFX");
     }
 }
Esempio n. 16
0
    //private AudioSource SE_e_shooterAttack;

    // Use this for initialization
    void Start()
    {
        _shot_time = 0.0f;
        _state     = STAET.STATE_MOVE;
        _player    = GameObject.Find("player");
        _rb        = GetComponent <Rigidbody2D> ();
        _anim      = GetComponent <Animator> ();
        _sound     = GameObject.Find("sound").GetComponent <sound>();
        //SE_e_shooterAttack = gameObject.GetComponent<AudioSource>();
    }
Esempio n. 17
0
    //private AudioSource SE_e_nearAttack;

    // Use this for initialization
    void Start()
    {
        _rb           = GetComponent <Rigidbody2D> ( );
        _player       = GameObject.Find("player");
        _move_count   = 0;
        _attack_count = 0;
        _state        = STATE.STATE_MOVE;
        _anim         = GetComponent <Animator> ();
        _sound        = GameObject.Find("sound").GetComponent <sound> ();
        //SE_e_nearAttack = gameObject.GetComponent<AudioSource>();
    }
Esempio n. 18
0
        public ActionResult Create([Bind(Include = "id_sound,name")] sound sound)
        {
            if (ModelState.IsValid)
            {
                db.sounds.Add(sound);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(sound));
        }
Esempio n. 19
0
    public void Play(string name)
    {
        sound s = Array.Find(sounds, sound => sound.name == name);

        if (s == null)
        {
            Debug.LogWarning("silly mistake");
            return;
        }
        s.source.Play();
    }
Esempio n. 20
0
    public void Stop(string name)
    {
        sound s = Array.Find(sounds, sound => sound.name == name);

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

        if (s == null)
        {
            Debug.LogError("the name of the sound does not match :(");
            return;
        }
        s.source.Play();
    }
Esempio n. 22
0
 void Awake()
 {
     if (game == null)
     {
         DontDestroyOnLoad(gameObject);
         game = this;
     }
     else if (game != this)
     {
         Destroy(gameObject);
     }
 }
Esempio n. 23
0
    public void Play(string name)
    {
        sound s = Array.Find(sounds, sound => sound.name == name);

        if (s == null)
        {
            Debug.Log("music ni mila");
            return;
        }

        s.source.Play();
    }
Esempio n. 24
0
    public void playSound(string name)
    {
        sound s = Array.Find(sounds, item => item.name == name);

        if (s == null)
        {
            Debug.Log("sound not found :" + name);
        }
        //s.source.volume = s.volume;
        //s.source.pitch = s.pitch;
        s.source.Play();
    }
Esempio n. 25
0
 void InitSound(sound item, bool firstInstance)
 {
     if (firstInstance)
     {
         FMOD.Studio.EventInstance instance = FMODUnity.RuntimeManager.CreateInstance(item.Event);
         item.instance = instance;
     }
     item.instance.set3DAttributes(FMODUnity.RuntimeUtils.To3DAttributes(gameObject));
     item.instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MINIMUM_DISTANCE, item.minDist);
     item.instance.setProperty(FMOD.Studio.EVENT_PROPERTY.MAXIMUM_DISTANCE, item.MaxDist);
     RuntimeManager.AttachInstanceToGameObject(item.instance, GetComponent <Transform>(), GetComponent <Rigidbody>());
 }
Esempio n. 26
0
        public void SoundsAddNewRecord(bool showDialog, string incomingGroup)
        {
            if (showDialog == true && string.IsNullOrEmpty(incomingGroup))
            {
                var dialog = SoundsImportOpenFileDialog;
                dialog.DefaultExt       = "*.xml";
                dialog.Filter           = "Audio File (*.wav)|*.wav|All files (*.*)|*.*";
                dialog.FilterIndex      = 1;
                dialog.RestoreDirectory = true;
                if (string.IsNullOrEmpty(dialog.FileName))
                {
                    dialog.FileName = "";
                }
                if (string.IsNullOrEmpty(dialog.InitialDirectory))
                {
                    dialog.InitialDirectory = SettingsFile.Current.FolderPath;
                }
                dialog.Title = "Add Audio File";
                var result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    var    grid = SoundsDataGridView;
                    int    i    = 0;
                    string group;
                    // Get all groups in lowercase.
                    var groups = SettingsFile.Current.Sounds.Select(x => x.group.ToLower()).ToArray();
                    // Loop until free group is found.
                    while (true)
                    {
                        i++;
                        group = string.Format("Group{0}", i);
                        // If group is unique and not in the list then break loop.
                        if (!groups.Contains(group.ToLower()))
                        {
                            break;
                        }
                    }

                    var snd = new sound();
                    snd.group = group;
                    //snd.file = MainHelper.ConvertToSpecialFoldersPattern(dialog.FileName);
                    snd.file = dialog.FileName;
                    SettingsFile.Current.Sounds.Add(snd);
                    grid.BeginEdit(true);
                }
            }
            else
            {
                var snd = new sound();
                snd.group = incomingGroup;
                SettingsFile.Current.Sounds.Add(snd);
            }
        }
Esempio n. 27
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            Yse.Yse.System().init();

            TimerCallback callback = new TimerCallback(Update);

            timer = new Timer(callback, null, 50, 50);

            FileManager = new BufferIO(true);

            byte[] fileBuffer = default(byte[]);
            using (StreamReader sr = new StreamReader(Assets.Open("countdown.ogg")))
            {
                using (var memstream = new MemoryStream())
                {
                    sr.BaseStream.CopyTo(memstream);
                    fileBuffer = memstream.ToArray();
                }
            }

            FileManager.AddBuffer("file1", fileBuffer, fileBuffer.Length);
            FileManager.SetActive(true);

            sound = new sound();
            sound.create("file1");

            // Get our button from the layout resource,
            // and attach an event to it
            Button startbutton = FindViewById <Button>(Resource.Id.startButton);

            startbutton.Click += delegate {
                sound.play();
                Yse.Yse.System().AudioTest(true);
                startbutton.Text = "" + sound.length();
            };

            Button pausebutton = FindViewById <Button>(Resource.Id.pauseButton);

            pausebutton.Click += delegate { sound.pause(); };

            Button stopbutton = FindViewById <Button>(Resource.Id.stopButton);

            stopbutton.Click += delegate {
                sound.stop();
                Yse.Yse.System().AudioTest(false);
            };
        }
Esempio n. 28
0
 public void PlaySound(string Name)
 {
     if (play)
     {
         sound s = System.Array.Find(sounds, sound => sound.ClipName == Name);
         if (s == null)
         {
             return;
         }
         s.source.volume = s.volume;
         s.source.Play();
     }
 }
Esempio n. 29
0
 private void PatcherButton_Click(object sender, RoutedEventArgs e)
 {
     if (patcherSound == null)
     {
         patcherSound = new sound();
         patcher      = new patcher();
         patcher.create(1);
         pHandle handle = patcher.CreateObject("~sine");
         //patcher.Connect(handle, 0, patcher.GetOutputHandle(0), 0);
         patcherSound.create(patcher);
         patcherSound.play();
     }
 }
Esempio n. 30
0
    //  plays the audio for name provided
    public void play(string name)
    {
        sound s = Array.Find(sounds, sound => sound.name == name);

        //  PURHAPS NEED TO DELAY THE IS PLAYING BY RANDOM VALUES??
        //  NEED TO FIGURE THIS OUT!
        if (s == null && !(s.isplaying()))
        {
            Debug.Log("sound: " + name + " is not found ");
            return;
        }
        s.source.Play();
    }
Esempio n. 31
0
 // Use this for initialization
 void Start()
 {
     //ゲームコントロールスクリプトの取得
     {
         var go = GameObject.Find("GameControl");
         GameControl = go.GetComponent<gamemain>();
         Camera2DControl = go.GetComponent<camera2d>();
         effectcontrol = go.GetComponent<effect_control>();
     }
     {
         var go = GameObject.Find("SoundContrlo");
         soundcontrol = go.GetComponent<sound>();
     }
     {
         //プレイヤーのgameobjectから動作を判断する
         var go = GameObject.Find("character_template_3head_Control");
         playercntrol = go.GetComponent<player>();
     }
 }
Esempio n. 32
0
 // Use this for initialization
 void Start()
 {
     //ゲームコントロールスクリプトの取得
     {
         var go = GameObject.Find("GameControl");
         GameControl = go.GetComponent<gamemain>();
         Camera2DControl = go.GetComponent<camera2d>();
         effectcontrol = go.GetComponent<effect_control>();
     }
     {
         var go = GameObject.Find("SoundContrlo");
         soundcontrol = go.GetComponent<sound>();
     }
     direction = 0;									//左向き
 }
Esempio n. 33
0
        public void playSound(sound s)
        {
            switch (s)
            {
                case sound.JUMP:
                    soundManager.jumpSound.Play();
                    break;

                case sound.DOUBLEJUMP:
                    soundManager.doubleJumpSound.Play();
                    break;

                case sound.ATTACK:
                    soundManager.attackSound.Play();
                    break;

                case sound.SMASH:
                    soundManager.smashAttackSound.Play();
                    break;

                case sound.SMASHHIT:
                    soundManager.smashHitSound.Play();
                    break;

                case sound.SHOCK:
                    soundManager.shockSound.Play();
                    break;

                case sound.SHOCKHIT:
                    soundManager.shockHitSound.Play();
                    break;

                case sound.SHOCKSMASHHIT:
                    soundManager.shockSmashHitSound.Play();
                    break;

                case sound.BULLET:
                    soundManager.bulletSound.Play();
                    break;

                case sound.SMASHBULLET:
                    soundManager.smashBulletSound.Play();
                    break;

                case sound.SHIELD:
                    soundManager.shieldSound.Play();
                    break;

                case sound.SHIELDBREAK:
                    soundManager.shieldBreakSound.Play();
                    break;

                case sound.PIKABREAK:
                    soundManager.pikaBreakSound.Play();
                    break;

                case sound.RESPAWN:
                    soundManager.respawnSound.Play();
                    break;

                case sound.DEATHCRY:
                    soundManager.deathCrySound.Play();
                    break;

                case sound.DEATHBLAST:
                    soundManager.deathExplosionSound.Play();
                    break;

            }
        }