Beispiel #1
0
    public void InitFromFile(string filename)
    {
        if (MapTiles == null)
        {
            MapTiles = new Texture2D(0, 0, TextureFormat.ARGB32, false);
            Texture2D[] tiles_tmp = new Texture2D[52];
            for (int i = 0; i < 52; i++)
            {
                int    t_c  = ((i & 0xF0) >> 4) + 1;
                int    t_d  = (i & 0x0F);
                string t_fn = string.Format("graphics/terrain/tile{0}-{1}.bmp", t_c, t_d.ToString().PadLeft(2, '0'));
                tiles_tmp[i] = Images.LoadImage(t_fn, Images.ImageType.AllodsBMP);
            }
            MapTiles.filterMode = FilterMode.Point;
            MapRects            = MapTiles.PackTextures(tiles_tmp, 1);
            foreach (Texture2D tex in tiles_tmp)
            {
                DestroyImmediate(tex);
            }
        }

        MapLogic.Instance.InitFromFile(filename);
        Debug.LogFormat("map = {0} ({1}x{2})", MapLogic.Instance.Title, MapLogic.Instance.Width - 16, MapLogic.Instance.Height - 16);

        InitMeshes();
        SetScroll(8, 8);
        MiniMap.UpdateTexture(true);

        // run generic load
        Load();

        this.transform.localScale = new Vector3(1, 1, 0.01f);
    }
Beispiel #2
0
    public void OnMapLoaded()
    {
        Debug.LogFormat("map = {0} ({1}x{2})", MapLogic.Instance.Title, MapLogic.Instance.Width - 16, MapLogic.Instance.Height - 16);

        InitMeshes();
        SetScroll(8, 8);
        MiniMap.UpdateTexture(true);

        // run generic load
        Load();

        this.transform.localScale = new Vector3(1, 1, 0.005f);
    }