コード例 #1
0
        private static void Chipz(int i, float f, ContO conto, Mad mad)
        {
            if (Math.Abs(f) > 100.0F)
            {
                if (f > 100.0F)
                {
                    f -= 100.0F;
                }
                if (f < -100.0F)
                {
                    f += 100.0F;
                }
                for (var i71 = 0; i71 < conto.Npl; i71++)
                {
                    var f72 = 0.0F;
                    for (var i73 = 0; i73 < conto.P[i71].N; i73++)
                    {
                        if (conto.P[i71].Wz == 0 &&
                            Py(conto.Keyx[i], conto.P[i71].Ox[i73], conto.Keyz[i], conto.P[i71].Oz[i73]) <
                            mad.Stat.Clrad)
                        {
                            f72 = f / 20.0F * Medium.Random();
                        }
                    }

                    if (f72 != 0.0F && Math.Abs(f72) >= 1.0F)
                    {
                        conto.P[i71].Chip  = 1;
                        conto.P[i71].Ctmag = f72;
                    }
                }
            }
        }
コード例 #2
0
        private static void Chipx(int i, float f, ContO conto, Mad mad)
        {
            if (Math.Abs(f) > 100.0F)
            {
                if (f > 100.0F)
                {
                    f -= 100.0F;
                }
                if (f < -100.0F)
                {
                    f += 100.0F;
                }
                for (var i68 = 0; i68 < conto.Npl; i68++)
                {
                    var f69 = 0.0F;
                    for (var i70 = 0; i70 < conto.P[i68].N; i70++)
                    {
                        if (conto.P[i68].Wz == 0 &&
                            Py(conto.Keyx[i], conto.P[i68].Ox[i70], conto.Keyz[i], conto.P[i68].Oz[i70]) <
                            mad.Stat.Clrad)
                        {
                            f69 = f / 20.0F * Medium.Random();
                        }
                    }

                    if (f69 == 0.0F || !(Math.Abs(f69) >= 1.0F))
                    {
                        continue;
                    }

                    conto.P[i68].Chip  = 1;
                    conto.P[i68].Ctmag = f69;
                }
            }
        }
コード例 #3
0
ファイル: Mad.cs プロジェクト: natigames/madmath
 private void Awake()
 {
     instance = this;
 }
コード例 #4
0
        private static void Regz(int i, float f, ContO conto, Mad mad)
        {
            if (Math.Abs(f) > 100.0F)
            {
                if (f > 100.0F)
                {
                    f -= 100.0F;
                }
                if (f < -100.0F)
                {
                    f += 100.0F;
                }
                for (var i65 = 0; i65 < conto.Npl; i65++)
                {
                    var f66 = 0.0F;
                    for (var i67 = 0; i67 < conto.P[i65].N; i67++)
                    {
                        if (conto.P[i65].Wz == 0 &&
                            Py(conto.Keyx[i], conto.P[i65].Ox[i67], conto.Keyz[i], conto.P[i65].Oz[i67]) <
                            mad.Stat.Clrad)
                        {
                            f66 = f / 20.0F * Medium.Random();
                            conto.P[i65].Oz[i67] += (int)(f66 * Medium.Cos(conto.Xz) * Medium.Cos(conto.Zy));
                            conto.P[i65].Ox[i67] += (int)(f66 * Medium.Sin(conto.Xz) * Medium.Cos(conto.Xy));
                        }
                    }

                    if (f66 != 0.0F)
                    {
                        if (Math.Abs(f66) >= 1.0F)
                        {
                            conto.P[i65].Chip  = 1;
                            conto.P[i65].Ctmag = f66;
                        }
                        if (!conto.P[i65].Nocol && conto.P[i65].Glass != 1)
                        {
                            if (conto.P[i65].Bfase > 20 && conto.P[i65].HSB[1] > 0.2)
                            {
                                conto.P[i65].HSB[1] = 0.2F;
                            }
                            if (conto.P[i65].Bfase > 30)
                            {
                                if (conto.P[i65].HSB[2] < 0.5)
                                {
                                    conto.P[i65].HSB[2] = 0.5F;
                                }
                                if (conto.P[i65].HSB[1] > 0.1)
                                {
                                    conto.P[i65].HSB[1] = 0.1F;
                                }
                            }
                            if (conto.P[i65].Bfase > 40)
                            {
                                conto.P[i65].HSB[1] = 0.05F;
                            }
                            if (conto.P[i65].Bfase > 50)
                            {
                                if (conto.P[i65].HSB[2] > 0.8)
                                {
                                    conto.P[i65].HSB[2] = 0.8F;
                                }
                                conto.P[i65].HSB[0] = 0.075F;
                                conto.P[i65].HSB[1] = 0.05F;
                            }
                            if (conto.P[i65].Bfase > 60)
                            {
                                conto.P[i65].HSB[0] = 0.05F;
                            }
                            conto.P[i65].Bfase += (int)Math.Abs(f66);
                            //new Color(conto.p[i65].c[0], conto.p[i65].c[1], conto.p[i65].c[2]);
                            var color = Color.GetHSBColor(conto.P[i65].HSB[0], conto.P[i65].HSB[1],
                                                          conto.P[i65].HSB[2]);
                            conto.P[i65].C[0] = color.R;
                            conto.P[i65].C[1] = color.G;
                            conto.P[i65].C[2] = color.B;
                        }
                        if (conto.P[i65].Glass == 1)
                        {
                            conto.P[i65].Gr += (int)Math.Abs(f66 * 1.5);
                        }
                    }
                }
            }
        }
コード例 #5
0
        private static void Regy(int i, float f, bool abool, ContO conto, Mad mad)
        {
            if (f > 100.0F)
            {
                f -= 100.0F;
                var i50 = 0;
                var i51 = 0;
                var i52 = conto.Zy;
                var i53 = conto.Xy;
                for (/**/; i52 < 360; i52 += 360)
                {
                }
                for (/**/; i52 > 360; i52 -= 360)
                {
                }
                if (i52 < 210 && i52 > 150)
                {
                    i50 = -1;
                }
                if (i52 > 330 || i52 < 30)
                {
                    i50 = 1;
                }
                for (/**/; i53 < 360; i53 += 360)
                {
                }
                for (/**/; i53 > 360; i53 -= 360)
                {
                }
                if (i53 < 210 && i53 > 150)
                {
                    i51 = -1;
                }
                if (i53 > 330 || i53 < 30)
                {
                    i51 = 1;
                }
                if (i51 * i50 == 0 || abool)
                {
                    for (var i54 = 0; i54 < conto.Npl; i54++)
                    {
                        var f55 = 0.0F;
                        for (var i56 = 0; i56 < conto.P[i54].N; i56++)
                        {
                            if (conto.P[i54].Wz == 0 &&
                                Py(conto.Keyx[i], conto.P[i54].Ox[i56], conto.Keyz[i], conto.P[i54].Oz[i56]) <
                                mad.Stat.Clrad)
                            {
                                f55 = f / 20.0F * Medium.Random();
                                conto.P[i54].Oz[i56] += (int)(f55 * Medium.Sin(i52));
                                conto.P[i54].Ox[i56] -= (int)(f55 * Medium.Sin(i53));
                            }
                        }

                        if (f55 != 0.0F)
                        {
                            if (Math.Abs(f55) >= 1.0F)
                            {
                                conto.P[i54].Chip  = 1;
                                conto.P[i54].Ctmag = f55;
                            }
                            if (!conto.P[i54].Nocol && conto.P[i54].Glass != 1)
                            {
                                if (conto.P[i54].Bfase > 20 && conto.P[i54].HSB[1] > 0.2)
                                {
                                    conto.P[i54].HSB[1] = 0.2F;
                                }
                                if (conto.P[i54].Bfase > 30)
                                {
                                    if (conto.P[i54].HSB[2] < 0.5)
                                    {
                                        conto.P[i54].HSB[2] = 0.5F;
                                    }
                                    if (conto.P[i54].HSB[1] > 0.1)
                                    {
                                        conto.P[i54].HSB[1] = 0.1F;
                                    }
                                }
                                if (conto.P[i54].Bfase > 40)
                                {
                                    conto.P[i54].HSB[1] = 0.05F;
                                }
                                if (conto.P[i54].Bfase > 50)
                                {
                                    if (conto.P[i54].HSB[2] > 0.8)
                                    {
                                        conto.P[i54].HSB[2] = 0.8F;
                                    }
                                    conto.P[i54].HSB[0] = 0.075F;
                                    conto.P[i54].HSB[1] = 0.05F;
                                }
                                if (conto.P[i54].Bfase > 60)
                                {
                                    conto.P[i54].HSB[0] = 0.05F;
                                }
                                conto.P[i54].Bfase += (int)f55;
                                new Color(conto.P[i54].C[0], conto.P[i54].C[1], conto.P[i54].C[2]);
                                var color = Color.GetHSBColor(conto.P[i54].HSB[0], conto.P[i54].HSB[1],
                                                              conto.P[i54].HSB[2]);
                                conto.P[i54].C[0] = color.R;
                                conto.P[i54].C[1] = color.G;
                                conto.P[i54].C[2] = color.B;
                            }
                            if (conto.P[i54].Glass == 1)
                            {
                                conto.P[i54].Gr += (int)Math.Abs(f55 * 1.5);
                            }
                        }
                    }
                }
                if (i51 * i50 == -1)
                {
                    var i57 = 0;
                    var i58 = 1;
                    for (var i59 = 0; i59 < conto.Npl; i59++)
                    {
                        var f60 = 0.0F;
                        for (var i61 = 0; i61 < conto.P[i59].N; i61++)
                        {
                            if (conto.P[i59].Wz == 0)
                            {
                                f60 = f / 15.0F * Medium.Random();
                                if ((Math.Abs(conto.P[i59].Oy[i61] - mad.Stat.Flipy - Squash[0, mad.Im]) <
                                     mad.Stat.Msquash * 3 ||
                                     conto.P[i59].Oy[i61] < mad.Stat.Flipy + Squash[0, mad.Im]) &&
                                    Squash[0, mad.Im] < mad.Stat.Msquash)
                                {
                                    conto.P[i59].Oy[i61] += (int)f60;
                                    i57 += (int)f60;
                                    i58++;
                                }
                            }
                        }

                        if (conto.P[i59].Glass == 1)
                        {
                            conto.P[i59].Gr += 5;
                        }
                        else if (f60 != 0.0F)
                        {
                            conto.P[i59].Bfase += (int)f60;
                        }
                        if (Math.Abs(f60) >= 1.0F)
                        {
                            conto.P[i59].Chip  = 1;
                            conto.P[i59].Ctmag = f60;
                        }
                    }
                    Squash[0, mad.Im] += i57 / i58;
                }
            }
        }
コード例 #6
0
        internal static void Playh(ContO conto, Mad mad, int i, int i38, int i39)
        {
            conto.X   = Hx[i38, i];
            conto.Y   = Hy[i38, i];
            conto.Z   = Hz[i38, i];
            conto.Zy  = Hzy[i38, i];
            conto.Xy  = Hxy[i38, i];
            conto.Xz  = Hxz[i38, i];
            conto.Wxz = Hwxz[i38, i];
            conto.Wzy = Hwzy[i38, i];
            if (i == i39)
            {
                Medium.Checkpoint = Hcheckpoint[i38];
                Medium.Lastcheck  = Hlastcheck[i38];
            }
            if (i38 == 0)
            {
                Cntdest[i] = 0;
            }
            if (Hdest[i] == i38)
            {
                Cntdest[i] = 7;
            }
            if (i38 == 0 && Hdest[i] < -1)
            {
                for (var i40 = 0; i40 < conto.Npl; i40++)
                {
                    if (conto.P[i40].Wz == 0 || conto.P[i40].Gr == -17 || conto.P[i40].Gr == -16)
                    {
                        conto.P[i40].Embos = 13;
                    }
                }
            }
            if (Cntdest[i] != 0)
            {
                for (var i41 = 0; i41 < conto.Npl; i41++)
                {
                    if (conto.P[i41].Wz == 0 || conto.P[i41].Gr == -17 || conto.P[i41].Gr == -16)
                    {
                        conto.P[i41].Embos = 1;
                    }
                }

                Cntdest[i]--;
            }
            for (var i42 = 0; i42 < 20; i42++)
            {
                for (var i43 = 0; i43 < 30; i43++)
                {
                    if (Hsspark[i, i42, i43] == i38)
                    {
                        conto.Stg[i42]   = 1;
                        conto.Sx[i42]    = Hsx[i, i42, i43];
                        conto.Sy[i42]    = Hsy[i, i42, i43];
                        conto.Sz[i42]    = Hsz[i, i42, i43];
                        conto.Osmag[i42] = Hsmag[i, i42, i43];
                        conto.Scx[i42]   = Hscx[i, i42, i43];
                        conto.Scz[i42]   = Hscz[i, i42, i43];
                    }
                }
            }
            for (var i44 = 0; i44 < 200; i44++)
            {
                if (Hrspark[i, i44] == i38)
                {
                    conto.Sprk = Hsprk[i, i44];
                    conto.Srx  = Hsrx[i, i44];
                    conto.Sry  = Hsry[i, i44];
                    conto.Srz  = Hsrz[i, i44];
                    conto.Rcx  = Hrcx[i, i44];
                    conto.Rcy  = Hrcy[i, i44];
                    conto.Rcz  = Hrcz[i, i44];
                }
            }

            for (var i45 = 0; i45 < 4; i45++)
            {
                for (var i46 = 0; i46 < 7; i46++)
                {
                    if (Hry[i, i45, i46] == i38 && _lastfr != i38)
                    {
                        Regy(i45, Hmagy[i, i45, i46], Hmtouch[i, i46], conto, mad);
                    }
                    if (Hrx[i, i45, i46] == i38)
                    {
                        if (_lastfr != i38)
                        {
                            Regx(i45, Hmagx[i, i45, i46], conto, mad);
                        }
                        else
                        {
                            Chipx(i45, Hmagx[i, i45, i46], conto, mad);
                        }
                    }

                    if (Hrz[i, i45, i46] == i38)
                    {
                        if (_lastfr != i38)
                        {
                            Regz(i45, Hmagz[i, i45, i46], conto, mad);
                        }
                        else
                        {
                            Chipz(i45, Hmagz[i, i45, i46], conto, mad);
                        }
                    }
                }
            }
            _lastfr = i38;
        }
コード例 #7
0
        internal static void Play(ContO conto, Mad mad, int i, int i30)
        {
            conto.X   = X[i30, i];
            conto.Y   = Y[i30, i];
            conto.Z   = Z[i30, i];
            conto.Zy  = Zy[i30, i];
            conto.Xy  = Xy[i30, i];
            conto.Xz  = Xz[i30, i];
            conto.Wxz = Wxz[i30, i];
            conto.Wzy = Wzy[i30, i];
            if (i == 0)
            {
                Medium.Checkpoint = Checkpoint[i30];
                Medium.Lastcheck  = Lastcheck[i30];
            }
            if (i30 == 0)
            {
                Cntdest[i] = 0;
            }
            if (Dest[i] == i30)
            {
                Cntdest[i] = 7;
            }
            if (i30 == 0 && Dest[i] < -1)
            {
                for (var i31 = 0; i31 < conto.Npl; i31++)
                {
                    if (conto.P[i31].Wz == 0 || conto.P[i31].Gr == -17 || conto.P[i31].Gr == -16)
                    {
                        conto.P[i31].Embos = 13;
                    }
                }
            }
            if (Cntdest[i] != 0)
            {
                for (var i32 = 0; i32 < conto.Npl; i32++)
                {
                    if (conto.P[i32].Wz == 0 || conto.P[i32].Gr == -17 || conto.P[i32].Gr == -16)
                    {
                        conto.P[i32].Embos = 1;
                    }
                }

                Cntdest[i]--;
            }
            for (var i33 = 0; i33 < 20; i33++)
            {
                for (var i34 = 0; i34 < 30; i34++)
                {
                    if (Sspark[i, i33, i34] == i30)
                    {
                        conto.Stg[i33]   = 1;
                        conto.Sx[i33]    = Sx[i, i33, i34];
                        conto.Sy[i33]    = Sy[i, i33, i34];
                        conto.Sz[i33]    = Sz[i, i33, i34];
                        conto.Osmag[i33] = Smag[i, i33, i34];
                        conto.Scx[i33]   = Scx[i, i33, i34];
                        conto.Scz[i33]   = Scz[i, i33, i34];
                    }
                }
            }
            for (var i35 = 0; i35 < 200; i35++)
            {
                if (Rspark[i, i35] == i30)
                {
                    conto.Sprk = Sprk[i, i35];
                    conto.Srx  = Srx[i, i35];
                    conto.Sry  = Sry[i, i35];
                    conto.Srz  = Srz[i, i35];
                    conto.Rcx  = Rcx[i, i35];
                    conto.Rcy  = Rcy[i, i35];
                    conto.Rcz  = Rcz[i, i35];
                }
            }

            for (var i36 = 0; i36 < 4; i36++)
            {
                for (var i37 = 0; i37 < 7; i37++)
                {
                    if (Ry[i, i36, i37] == i30)
                    {
                        Regy(i36, Magy[i, i36, i37], Mtouch[i, i37], conto, mad);
                    }
                    if (Rx[i, i36, i37] == i30)
                    {
                        Regx(i36, Magx[i, i36, i37], conto, mad);
                    }
                    if (Rz[i, i36, i37] == i30)
                    {
                        Regz(i36, Magz[i, i36, i37], conto, mad);
                    }
                }
            }
        }