//* ────────────-_______________________* //* 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(); }
//* -----------------------------------------------------------------------* /// <summary>1フレーム分の描画処理を実行します。</summary> private IEnumerator coAlpha() { const int FADETIME = 60; for ( int i = 0; i < FADETIME; m_fAlpha = CInterpolate._clampAccelerate(0, 1, ++i, FADETIME) ) { yield return(null); } for (int i = 0; i < 120; i++) { yield return(null); } for ( int i = 0; i < FADETIME; m_fAlpha = CInterpolate._clampAccelerate(1, 0, ++i, FADETIME) ) { yield return(null); } phaseManager.reserveNextPhase = true; }
//* -----------------------------------------------------------------------* /// <summary>加速変化する内分カウンタです。</summary> /// /// <param name="start"><paramref name="now"/>が0と等しい場合の値</param> /// <param name="end"> /// <paramref name="now"/>が<paramref name="limit"/>と等しい場合の値 /// </param> /// <param name="now">現在時間</param> /// <param name="limit"><paramref name="end"/>に到達する時間</param> /// <returns> /// 0から<paramref name="limit"/>までの<paramref name="now"/>に相当する /// <paramref name="start"/>から<paramref name="end"/>までの値 /// </returns> private byte interpolate(float start, float end, float now, float limit) { float result = CInterpolate._clampAccelerate(start, end, now, limit); return((byte)((int)(result / 16) * 16)); }