コード例 #1
0
 public ScaleDecider(MelodyPlayer.Note note, ScaleType scaleType)
 {
     currentScale             = CreateScale(note, scaleType);
     currentScaleType         = scaleType;
     towerUnderHP             = false;
     inTransition             = false;
     clickCounter             = 0;
     random                   = new Random();
     SCALE_CHANGE_HP_TRESHOLD = (App.Instance.Model.Tower.MaxHealth - 100) * 0;
 }
コード例 #2
0
        private Scale CreateScale(MelodyPlayer.Note note, ScaleType scaleType)
        {
            int scaleLength = scaleSignature[(int)scaleType].Length;
            int len         = scaleLength * 4;

            int[] result = new int[len];
            result[0] = (int)note;
            for (int i = 0; i < len - 1; i++)
            {
                result[i + 1] = (result[i] + scaleSignature[(int)scaleType][i % scaleLength]);
                if (result[i + 1] > MelodyPlayer.SOUNDPACKSIZE)
                {
                    result[i + 1] = (result[i + 1] % MelodyPlayer.SOUNDPACKSIZE);
                }
            }

            return(new Scale(result, scaleType));
        }