Exemple #1
0
 void _makeInstance()
 {
     if (instance == null)
     {
         instance = this;
     }
 }
Exemple #2
0
    IEnumerator Start()
    {
        yield return(CfgLoader.Load());

        print("CfgLoader finish");
        yield return(Map.Instance.load());

        print("map finish");
        Map.Instance.createMap(32, 32, 1);
        cameraCotroller = Camera.main.transform.parent.GetComponent <CameraCotroller>();
        cameraCotroller.init(Map.Instance);
        //SpriteAnimCfg sfg=SpriteAnimCfg.get(1);
        //Object o=Resources.Load("characters/1.0");
        //print(o);
        //Sprite s = Sprite.Create(o as Texture2D,new Rect(0,0,50,50),new Vector2());
        //spriteRenderer.sprite = s;
        //Resources.UnloadAsset(o);
        //ResourceLoadTask task = new ResourceLoadTask();
        //task.path = "characters";
        //task.name = "1.0.png";
        //yield return ResourceLoader.LoadAssetAsync(task);
        //print(task.asset);
        yield return(unitManager.init());

        LoaderResult r = new LoaderResult();

        yield return(unitManager.loadUnitType(1, r));


        Player p = new Player();

        unit           = unitManager.createUnit(unitManager.id2UnitType[1], p);
        unit.direction = UnitDirection.LookingE;
        //foreach ( Sprite  l in unit.unitType.sprite.runAnim[1])
        //{
        //    Debug.Log(l);
        //}
    }