コード例 #1
0
ファイル: GameSoundEffect.cs プロジェクト: stackprobe/Fairy
 private static void UpdateSEVolumeFunc(SEInfo i)
 {
     for (int index = 0; index < SE_HANDLE_MAX; index++)
     {
         GameSound.SetVolume(i.HandleList[index], GameSound.MixVolume(GameGround.I.SEVolume, i.Volume));
     }
 }
コード例 #2
0
 public AudioClipInfo(AudioType type, string resourcename, string systemname, float initvolume, int maxSEcount = 16 )
 {
     ResourceName = resourcename;
     if (type == AudioType.SE)
     {
         ResourcePath = SEPath + resourcename;
     }
     else if (type == AudioType.BGM) {
         ResourcePath = BGMPath + resourcename;
     }
     SystemName = systemname;
     MaxSECount = maxSEcount;
     PlayingList = new List<SEInfo>(maxSEcount);
     StockList = new SortedList<int, SEInfo>(maxSEcount);
     InitVolume = initvolume;
     AttenuateRate = calcAttenuateRate();
     //Debug.Log("Att: " + AttenuateRate);
     for (int i = 0; i < MaxSECount; i++) {
         //Debug.LogFormat("InitVol:{0}",InitVolume);
         SEInfo seinfo = new SEInfo(i, 0f, InitVolume * Mathf.Pow(AttenuateRate, i));
         //SEInfo seinfo = new SEInfo(i, 0f, InitVolume);
         StockList.Add(seinfo.Index, seinfo);
         //Debug.Log("Vol: " + seinfo.Volume);
     }
     Loop = null;
 }
コード例 #3
0
ファイル: AudioClipInfo.cs プロジェクト: Soumakakami/GameJam
    public float attenuate = 0.0f;       // 合成時減衰率

    public AudioClipInfo(AudioClip clip)
    {
        this.clip = clip;
        attenuate = CalcAttenuateRate();
        // create stock list
        for (int i = 0; i < MAX_PLAY_COUNT; i++)
        {
            SEInfo seInfo = new SEInfo(i, 0.0f, Mathf.Pow(attenuate, i));
            stockList.Add(seInfo.index, seInfo);
        }
    }
コード例 #4
0
ファイル: GameSoundEffect.cs プロジェクト: stackprobe/Fairy
        private static void DoAlterCommand(int seId, char alterCommand)
        {
            SEInfo i = SERes.I.GetHandle(seId);

            PlayList.Enqueue(new SEInfoEx()
            {
                Info         = i,
                AlterCommand = alterCommand,
            });

            PlayList.Enqueue(null);
        }
コード例 #5
0
    public float Attenuate;       // 合成時減衰率

    public AudioClipInfo(AudioClip clip)
    {
        Clip      = clip;
        Attenuate = CalcAttenuateRate();

        // create stock list
        for (var i = 0; i < MaxPlayCount; i++)
        {
            var seInfo = new SEInfo(i, 0.0f, Mathf.Pow(Attenuate, i));
            StockList.Add(seInfo.Index, seInfo);
        }
    }
コード例 #6
0
ファイル: SoundManager.cs プロジェクト: NORI0524/Gust_project
        //コンストラクタ
        public AudioClipInfo(string _resourceName, string _name, int _maxSENum, float _initVolume)
        {
            this.resourceName = _resourceName;
            this.name         = _name;

            this.maxSENum   = _maxSENum;
            this.initVolume = _initVolume;
            attenuate       = CalcAttenuateRate();

            // create stock list
            for (int i = 0; i < maxSENum; i++)
            {
                SEInfo seInfo = new SEInfo(i, 0.0f, initVolume * Mathf.Pow(attenuate, i));
                stockList.Add(seInfo.index, seInfo);
            }
        }
コード例 #7
0
ファイル: GameSoundEffect.cs プロジェクト: stackprobe/Fairy
        private static SEInfo LoadSE(byte[] fileData)
        {
            SEInfo i = new SEInfo();

            i.HandleList[0] = GameSound.LoadSound(fileData);

            for (int index = 1; index < SE_HANDLE_MAX; index++)
            {
                i.HandleList[index] = GameSound.DuplSound(i.HandleList[0]);
            }
            i.Volume = 0.5;             // 個別の音量のデフォルト 0.0 - 1.0

            // TODO ??? post LoadSound

            UpdateSEVolumeFunc(i);
            return(i);
        }
コード例 #8
0
ファイル: GameSoundEffect.cs プロジェクト: stackprobe/Fairy
        public static void SEPlay(int seId)
        {
            SEInfo i     = SERes.I.GetHandle(seId);
            int    count = 0;

            foreach (SEInfoEx info in PlayList.ToArray())
            {
                if (info.Info == i && 2 <= ++count)
                {
                    return;
                }
            }

            PlayList.Enqueue(new SEInfoEx()
            {
                Info = i
            });
            PlayList.Enqueue(null);
        }
コード例 #9
0
ファイル: SoundManager.cs プロジェクト: NORI0524/Gust_project
    //SEを再生
    public bool PlaySE(string seName)
    {
        //指定のSEが登録されていない場合
        if (!audioClips.ContainsKey(seName))
        {
            return(false);
        }

        AudioClipInfo info = audioClips[seName];

        //ロード
        if (info.clip == null)
        {
            info.clip = (AudioClip)Resources.Load(info.resourceName);
        }

        if (soundPlayer == null)
        {
            soundPlayer = new GameObject("SoundPlayer");
            audioSource = soundPlayer.AddComponent <AudioSource>();
        }

        float len = info.clip.length;

        if (info.stockList.Count > 0)
        {
            SEInfo seInfo = info.stockList.Values[0];
            seInfo.curTime = len;
            info.playingList.Add(seInfo);

            // remove from stock
            info.stockList.Remove(seInfo.index);

            // Play SE
            audioSource.PlayOneShot(info.clip, seInfo.volume);
            Debug.Log("SE_Volume : " + seInfo.volume);

            return(true);
        }
        return(false);
    }
コード例 #10
0
    public bool playSE(string seName)
    {
        if (audioClips.ContainsKey(seName) == false)
        {
            return(false); // not register
        }
        AudioClipInfo info = audioClips[seName];

        // Load
        if (info.clip == null)
        {
            info.clip = (AudioClip)Resources.Load(info.resourceName);
        }

        if (soundPlayerObj == null)
        {
            soundPlayerObj = new GameObject("SoundControl");
            audioSource    = soundPlayerObj.AddComponent <AudioSource>();
        }

        float len = info.clip.length / 10;

        if (info.stockList.Count > 0)
        {
            SEInfo seInfo = info.stockList.Values[0];
            seInfo.curTime = len;
            info.playingList.Add(seInfo);

            // remove from stock
            info.stockList.Remove(seInfo.index);

            // Play SE
            audioSource.PlayOneShot(info.clip, seInfo.volume);
            return(true);
        }

        return(true);
    }
コード例 #11
0
ファイル: Pose.cs プロジェクト: vwr0527/Virulent-game
        public static void RunEditor(InputManager input)
        {
            //Debug.WriteLine("RunEditor running: " + editor_pose_loaded + " " + editor_part_selected + " " + editor_option_selected);
            if (!editor_active) return;

            //if a pose is selected, arrow key means change current selected part
            if (editor_pose_loaded && !editor_part_selected)
            {
                if (input.DownPressed())
                {
                    ++editor_current_part_index;
                    if (editor_current_part_index > selectedPose.sprites.Count - 1)
                    {
                        editor_current_part_index = 0;
                    }
                }
                if (input.UpPressed())
                {
                    --editor_current_part_index;
                    if (editor_current_part_index < 0)
                    {
                        editor_current_part_index = selectedPose.sprites.Count - 1;
                    }
                }
                selectedPart = selectedPose.sprites[editor_current_part_index];
                if (input.EnterPressed())
                {
                    editor_part_selected = true;
                }
                //if (input.BackspacePressed()) editor_pose_loaded = false;
            }
            else
            if (editor_pose_loaded && editor_part_selected && !editor_option_selected)
            {
                if (input.DownPressed())
                {
                    ++selectedOption;
                    if (selectedOption > num_part_options)
                    {
                        selectedOption = 0;
                    }
                }
                if (input.UpPressed())
                {
                    --selectedOption;
                    if (selectedOption < 0)
                    {
                        selectedOption = num_part_options;
                    }
                }
                if (input.EnterPressed())
                {
                    editor_option_selected = true;
                }
                if (input.BackspacePressed()) editor_part_selected = false;
            }
            else
            if (editor_pose_loaded && editor_part_selected && editor_option_selected)
            {
                if ((!input.IsUpPressed()) && (!input.IsDownPressed()) && (!input.IsLeftPressed()) && (!input.IsRightPressed())) editor_option_adjust_speed = 0.0f;
                else
                switch (selectedOption)
                {
                    default:
                    case 0:
                    if (input.IsLeftPressed())
                    {
                        selectedPart.x -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.1f;
                    }
                    if (input.IsRightPressed())
                    {
                        selectedPart.x += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.1f;
                    }
                    if (input.IsDownPressed())
                    {
                        selectedPart.y += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.1f;
                    }
                    if (input.IsUpPressed())
                    {
                        selectedPart.y -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.1f;
                    }
                    break;
                    case 1:
                    if (input.IsDownPressed() || input.IsRightPressed())
                    {
                        selectedPart.rot += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    if (input.IsUpPressed() || input.IsLeftPressed())
                    {
                        selectedPart.rot -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    break;
                    case 2:
                    if (input.IsDownPressed() || input.IsRightPressed())
                    {
                        selectedPart.scale += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    if (input.IsUpPressed() || input.IsLeftPressed())
                    {
                        selectedPart.scale -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    break;
                    case 3:
                    if (input.IsDownPressed() || input.IsRightPressed())
                    {
                        selectedPart.r += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    if (input.IsUpPressed() || input.IsLeftPressed())
                    {
                        selectedPart.r -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    break;
                    case 4:
                    if (input.IsDownPressed() || input.IsRightPressed())
                    {
                        selectedPart.g += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    if (input.IsUpPressed() || input.IsLeftPressed())
                    {
                        selectedPart.g -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    break;
                    case 5:
                    if (input.IsDownPressed() || input.IsRightPressed())
                    {
                        selectedPart.b += editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    if (input.IsUpPressed() || input.IsLeftPressed())
                    {
                        selectedPart.b -= editor_option_adjust_speed;
                        editor_option_adjust_speed += 0.01f;
                    }
                    break;
                }
                selectedPose.sprites[editor_current_part_index] = selectedPart;
                if (input.BackspacePressed()) editor_option_selected = false;
                if (input.EnterPressed())
                {
                    for (int i = 0; i < selectedPose.sprites.Count; ++i)
                    {
                        Debug.WriteLine("anim.AddSpriteInfo(" + selectedPose.sprites[i].x
                                                         + "f," + selectedPose.sprites[i].y
                                                         + "f," + selectedPose.sprites[i].scale
                                                         + "f," + selectedPose.sprites[i].rot
                                                         + "f," + selectedPose.sprites[i].r
                                                         + "f," + selectedPose.sprites[i].g
                                                         + "f," + selectedPose.sprites[i].b
                                                         + "f);");
                    }
            //anim.AddSpriteInfo(-2f, -15f, 0.5f, 0, 0, 1f, 1f);//head
                }
            }
        }
コード例 #12
0
ファイル: Pose.cs プロジェクト: vwr0527/Virulent-game
 public void Add(float x, float y)
 {
     SEInfo spriteinfo = new SEInfo();
     spriteinfo.x = x;
     spriteinfo.y = y;
     spriteinfo.scale = 1;
     spriteinfo.rot = 0;
     spriteinfo.r = 1;
     spriteinfo.g = 1;
     spriteinfo.b = 1;
     sprites.Add(spriteinfo);
 }
コード例 #13
0
ファイル: Pose.cs プロジェクト: vwr0527/Virulent-game
 public void Add(float x, float y, float scale, float rot)
 {
     SEInfo spriteinfo = new SEInfo();
     spriteinfo.x = x;
     spriteinfo.y = y;
     spriteinfo.scale = scale;
     spriteinfo.rot = rot;
     spriteinfo.r = 1;
     spriteinfo.g = 1;
     spriteinfo.b = 1;
     sprites.Add(spriteinfo);
 }
コード例 #14
0
ファイル: Pose.cs プロジェクト: vwr0527/Virulent-game
 public void Add(float x, float y, float scale, float rot, float r, float g, float b)
 {
     SEInfo spriteinfo = new SEInfo();
     spriteinfo.x = x;
     spriteinfo.y = y;
     spriteinfo.scale = scale;
     spriteinfo.rot = rot;
     spriteinfo.r = r;
     spriteinfo.g = g;
     spriteinfo.b = b;
     sprites.Add(spriteinfo);
 }
コード例 #15
0
ファイル: GameSoundEffect.cs プロジェクト: stackprobe/Fairy
 private static void UnloadSE(SEInfo i)
 {
     i.Dispose();
 }