Пример #1
0
        //* ────────────-_______________________*
        //* constructor & destructor ───────────────────────*

        //* -----------------------------------------------------------------------*
        /// <summary>静的なコンストラクタ。</summary>
        /// <remarks>ここで加速度グラフ情報を作成します。</remarks>
        static CBall()
        {
            List <float> graph      = new List <float>();
            float        fPrevSpeed = 0f;

            for (SPhase phase = SPhase.initialized; phase < 3; phase.count++)
            {
                int   nPCount = phase.countPhase;
                int   nPLimit = accelerateTime[phase];
                float fSpeed  = MAX_SPEED;
                switch (phase)
                {
                case 0:
                    fSpeed = CInterpolate._clampSlowFastSlow(0, MAX_SPEED, nPCount, nPLimit);
                    break;

                case 2:
                    fSpeed = CInterpolate._clampAccelerate(MAX_SPEED, 0, nPCount, nPLimit);
                    break;
                }
                graph.Add(fSpeed - fPrevSpeed);
                fPrevSpeed             = fSpeed;
                phase.reserveNextPhase = nPCount >= nPLimit;
            }
            accelerateGraph = graph.AsReadOnly();
        }
Пример #2
0
        //* ────────────-_______________________*
        //* constructor & destructor ───────────────────────*

        //* -----------------------------------------------------------------------*
        /// <summary>静的なコンストラクタ。</summary>
        /// <remarks>ここで加速度グラフ情報を作成します。</remarks>
        static CBall()
        {
            List <float> graph      = new List <float>();
            float        fPrevSpeed = 0f;

            for (SPhase phase = SPhase.initialized; phase < 3; phase.count++)
            {
                int   nPCount = phase.countPhase;
                int   nPLimit = accelerateTime[phase];
                float fSpeed  = MAX_SPEED;
                switch (phase)
                {
                case 0:
                    fSpeed = CInterpolate.lerpClampInOutQuad(0, MAX_SPEED, nPCount, nPLimit);
                    break;

                case 2:
                    fSpeed = CInterpolate.lerpClampInQuad(MAX_SPEED, 0, nPCount, nPLimit);
                    break;
                }
                graph.Add(fSpeed);
                fPrevSpeed             = fSpeed;
                phase.reserveNextPhase = nPCount >= nPLimit;
            }
            speedGraph = graph.AsReadOnly();
            enemy      = new CBall();
            player     = new CBall();
        }