Esempio n. 1
0
    private void addHero(int team, FightPlayerModel model)
    {
        GameObject o;

        if (team == 1)
        {
            o = (GameObject)Instantiate(ResourceLoad.getHeroModel(model.heroId), GameData.teamOneStart, Quaternion.identity);
        }
        else
        {
            o = (GameObject)Instantiate(ResourceLoad.getHeroModel(model.heroId), GameData.teamTwoStart, Quaternion.identity);
        }
        IHero pc = o.GetComponent <PlayerComponent>().con;

        pc.setData(model);
        //todo set hpbar, case now, we use gui statebar for quick start
        //GameObject hp = Instantiate<GameObject>(ResourceLoad.getBar());
        //pc.setHp(hp, scene.par);
        if (scene.myTeam == team)
        {
            //o.layer = LayerMask.NameToLayer("visible");
            //hp.GetComponent<HpProcess>().setColorAndName(Color.green, model.name);
            //Destroy(o.GetComponent<EnemyEye>());
            pc.setTag(Tags.FriendHero);
            if (model.id == GameData.user.id)
            {
                FightScene.player = model;
                scene.myHero      = o;
                //todo set head portrait
                //scene.myHead.sprite = ResourceLoad.getHead(model.heroId.ToString());

                scene.initUI();
                //scene.cameraReset();
                //scene.InitFollowCamera(o);
            }
        }
        else
        {
            //o.layer = LayerMask.NameToLayer("disible");

            pc.setTag(Tags.EnemyHero);
            //hp.GetComponent<HpProcess>().setColorAndName(Color.red, model.name);
        }
        Debug.Log(model.id);
        heros.Add(model.id, o);
    }