Exemple #1
0
        public static void LoadMatrixLayers()
        {
            Gondwana.Common.Timers.Timers.Add("matrix_move", TimerType.PreCycle, TimerCycles.Repeating, 0.01).Tick +=
                new Gondwana.Common.EventArgs.TimerEventHandler(Timers_Tick);

            matrix = new GridPointMatrix(8, 8, 64, 32);
            matrix.WrapHorizontally = false;
            matrix.WrapVertically = false;
            matrix.CoordinateSystem = new SquareIsoCoordinates();

            layers = new GridPointMatrixes(matrix);

            matrix2 = new GridPointMatrix(12, 12, 64, 32);
            matrix2.CoordinateSystem = new SquareIsoCoordinates();

            matrix2.BindScrollingToParentGrid(matrix);

            layers.AddLayer(matrix2).LayerSyncModifier = (float)0.25;

            //matrix3 = new GridPointMatrix(12, 12, 64, 32);
            //layers.AddLayer(matrix3).LayerSyncModifier = (float)0.5;
            //matrix3.CoordinateSystem = new SquareIsoCoordinates();
            //matrix3.BindScrollingToParentGrid(matrix);

            /*
            foreach (GridPoint gridPt in matrix)
            {
                if (gridPt.GridCoordinates.X < 2 && gridPt.GridCoordinates.Y < 2)
                {
                    gridPt.EnableFog = false;
                    gridPt.CurrentFrame = new Frame(tilesheet, 2, 7);
                }
            }
            */

            //matrix[5, 5].CurrentFrame = new Frame(tilesheet, 2, 7);

            foreach (GridPoint gridPt in matrix)
                gridPt.CurrentFrame = new Frame(tilesheet, 0, 0);

            int i = 0;
            foreach (GridPoint gridPt in matrix2)
            {
                switch (i++ % 3)
                {
                    case 0:
                        gridPt.CurrentFrame = new Frame(tilesheet, 1, 6);
                        break;
                    case 1:
                        gridPt.CurrentFrame = new Frame(tilesheet, 1, 7);
                        break;
                    case 2:
                        gridPt.CurrentFrame = new Frame(tilesheet, 1, 8);
                        break;
                    default:
                        break;
                }
            }
        }