示例#1
0
        public Game1()
        {
            //gd = graphics.CreateDevice();
            graphics = new GraphicsDeviceManager (this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = false;

            for(int i=0; i < MAX_LEVEL_SIZE; i++)
            {
                for(int j=0; j < MAX_LEVEL_SIZE; j++)
                {
                    palya[i,j] = new Field(palyatomb[i,j],0, i ,j);
                }

            }

            stateMessage = "It's Mario turn.";

            palya[0,0].UnitState = 1;
            palya[4,4].UnitState = 2;
        }
示例#2
0
        int Distance(Field f1, Field f2)
        {
            int dx = f1.x - f2.x;
            int dy = f1.y - f2.y;

            if (Math.Sign(dx) != Math.Sign(dy))
            {
                return Math.Abs(dx) + Math.Abs(dy);
            }
            else
                return Math.Max(Math.Abs(dx), Math.Abs(dy));
        }