コード例 #1
0
        static public bool create(Dictionary <string, object> dict, List <Wave> waves)
        {
            if (MiniJsonHelper.getString(dict, "type", "") != "trochoidStraight")
            {
                return(false);
            }
            int num = MiniJsonHelper.getInt(dict, "num", 1);

            float[] degree        = MiniJsonHelper.getFloatArray(dict, "degree");
            float[] waveLength    = MiniJsonHelper.getFloatArray(dict, "waveLength");
            float[] amplitudeRate = MiniJsonHelper.getFloatArray(dict, "amplitudeRate");
            float[] phase         = MiniJsonHelper.getFloatArray(dict, "phase");
            float[] sec           = MiniJsonHelper.getFloatArray(dict, "sec");

            // 生成
            var rand = new Random();

            for (int i = 0; i < num; ++i)
            {
                var wave = new TrochoidStraightWave();
                wave.Degree        = frand(degree, rand);
                wave.WaveLength    = frand(waveLength, rand);
                wave.AmplitudeRate = frand(amplitudeRate, rand);
                wave.PhaseSpeed    = frand(phase, rand);
                wave.setTime(frand(sec, rand));
                waves.Add(wave);
            }

            return(true);
        }
コード例 #2
0
        // クローン作成
        override public Wave clone()
        {
            var obj = new TrochoidStraightWave();

            obj.Degree        = Degree;
            obj.WaveLength    = WaveLength;
            obj.AmplitudeRate = AmplitudeRate;
            obj.phaseSpeed_   = phaseSpeed_;
            obj.setTime(Time);
            return(obj);
        }