예제 #1
0
    protected void MoveCharacterTowardsTile(int Clicked_TileID)
    {
        e_xdirection xdirection = e_xdirection.none;
        e_ydirection ydirection = e_ydirection.none;

        MMO.Tile itemTile = Tiles.Find(FindID);

        if (itemTile.X > chr.x)
        {
            xdirection = e_xdirection.down;
        }
        else
        {
            if (itemTile.X < chr.x)
            {
                xdirection = e_xdirection.up;
            }
        }

        if (itemTile.Y > chr.y)
        {
            ydirection = e_ydirection.right;
        }
        else
        {
            if (itemTile.Y < chr.y)
            {
                ydirection = e_ydirection.left;
            }
        }

        if (!((ydirection == e_ydirection.none) && (xdirection == e_xdirection.none)))
        {
            chr.y += (int)ydirection;
            chr.x += (int)xdirection;

            characterDB db = new characterDB("joseph");
            db.Save(chr);

            getUserCharacter();
            LoadTiles();
        }
    }
예제 #2
0
 // belongs in characterDB
 protected void getUserCharacter()
 {
     MMO.characterDB chrDB = new characterDB("joseph");
     chr = chrDB.GetCharacters().First();
 }