コード例 #1
0
ファイル: MyCueBank.cs プロジェクト: Pharap/GetOreMarkersInPB
        public MyInMemoryWave GetRandomWave(MyObjectBuilder_CueDefinition cue)
        {
            int            randomIndex = MyVRageUtils.GetRandomInt(cue.Waves.Length);
            string         waveToPlay  = cue.Waves[randomIndex];
            MyInMemoryWave wave        = m_waveBank.GetWave(waveToPlay);

            if (wave == null)
            {
                return(null);
            }

            return(wave);
        }
コード例 #2
0
ファイル: MyCueBank.cs プロジェクト: Pharap/GetOreMarkersInPB
        public string GetRandomTransitionCategory(MyMusicTransitionEnum transitionEnum)
        {
            int randomIndex  = MyVRageUtils.GetRandomInt(m_musicTransitionCues[(int)transitionEnum].Count);
            int currentIndex = 0;

            foreach (var categoryCueKVP in m_musicTransitionCues[(int)transitionEnum])
            {
                if (currentIndex == randomIndex)
                {
                    return(categoryCueKVP.Key);
                }
                currentIndex++;
            }
            throw new InvalidBranchException();
        }
コード例 #3
0
        private void EnsureMutable()
        {
            if (!IsMutable)
            {
                MyStorageBase existingStorage = null;
                string        newName;
                do
                {
                    newName = string.Format("{0}-{1}", m_trueStorage.Name, MyVRageUtils.GetRandomInt(int.MaxValue).ToString("########"));
                    MySession.Static.VoxelMaps.TryGetStorage(newName, out existingStorage);
                }while(existingStorage != null);

                m_trueStorage = m_trueStorage.DeepCopy(newName);
                IsMutable     = true;
            }
        }
コード例 #4
0
        public bool WrinkleVoxelContent(ref Vector3I p, float wrinkleWeightAdd, float wrinkleWeightRemove)
        {
            int max = Int32.MinValue, min = Int32.MaxValue;
            int randomizationAdd    = (int)(wrinkleWeightAdd * 255);
            int randomizationRemove = (int)(wrinkleWeightRemove * 255);

            for (int z = -1; z <= 1; z++)
            {
                for (int y = -1; y <= 1; y++)
                {
                    for (int x = -1; x <= 1; x++)
                    {
                        Vector3I tempVoxelCoord = new Vector3I(p.X + x, p.Y + y, p.Z + z);
                        var      content        = Content(ref tempVoxelCoord);
                        max = Math.Max(max, content);
                        min = Math.Min(min, content);
                    }
                }
            }

            if (min == max)
            {
                return(false);
            }

            int old = Content(ref p);

            byte newVal             = (byte)MyVRageUtils.GetClampInt(old + MyVRageUtils.GetRandomInt(randomizationAdd + randomizationRemove) - randomizationRemove, min, max);

            newVal = MyCellStorage.Quantizer.QuantizeValue(newVal);

            if (newVal != old)
            {
                Content(ref p, (byte)newVal);
                return(true);
            }
            return(false);
        }
コード例 #5
0
ファイル: MyCueBank.cs プロジェクト: Pharap/GetOreMarkersInPB
 public MyMusicTransitionEnum GetRandomTransitionEnum()
 {
     return((MyMusicTransitionEnum)MyVRageUtils.GetRandomInt(m_musicTransitionCues.Length));
 }