Beispiel #1
0
    public override void Update()
    {
        for (int i = 0; i < enemyPoints.Count; i++)
        {
            enemyPoints[i].ObjUpdate();
        }
        for (int i = enemyList.Count - 1; i >= 0; i--)
        {
            if (enemyList[i] == null)
            {
                enemyList.RemoveAt(i);
            }
        }
        List <CharacterConf> roleList = ConfigManager.characterConfManager.dicByType[(int)CharacterConf.enCharacterType.enemy];

        while (enemyList.Count < 5)
        {
            //InGameBaseCharacter enemy = InGameManager.GetInstance().inGameObjManager.AddObj(roleList[Random.Range(0, roleList.Count)].id, enMSCamp.en_camp_enemy) as InGameBaseCharacter;
            InGameBaseCharacter enemy = InGameManager.GetInstance().inGameObjManager.AddObj(100008, enMSCamp.en_camp_enemy) as InGameBaseCharacter;
            //100011
            enemy.AddAI();

            Vector3 pos = InGameManager.GetInstance().inGameLevelManager.gameMap.GetRandomWay();
            enemy.transform.position = GameCommon.GetWorldPos(pos);
            enemy.SetZPos();

            enemyList.Add(enemy);
        }
    }
Beispiel #2
0
    InGameBaseCharacter AddObj(int id, Vector2 pos)
    {
        InGameBaseCharacter enemy = InGameManager.GetInstance().inGameObjManager.AddObj(id, enMSCamp.en_camp_enemy) as InGameBaseCharacter;

        enemyList.Add(enemy);
        enemy.SetIsElite(isElite);
        enemy.AddAI();

        enemy.transform.position = pos;
        enemy.SetZPos();
        return(enemy);
    }
Beispiel #3
0
    public override void Init()
    {
        base.Init();


        EventManager.Register(this,
                              EventID.EVENT_GAME_TOUCH_GROUND,
                              EventID.EVENT_GAME_TOUCH_OBJ,
                              EventID.EVENT_UI_EQUIP,
                              EventID.EVENT_UI_DELEQUIP,
                              EventID.EVENT_UI_UNEQUIP,
                              EventID.EVENT_DATA_REFRESHPROPERTY);


        RoleData rd = UserDataManager.instance.GetChooseRoleData();

        role = InGameManager.GetInstance().inGameObjManager.AddObj(rd.roldid,enMSCamp.en_camp_player) as InGameBaseCharacter;
        role.SetData(rd);

        //InGameManager.GetInstance().GetManager<InGameObjManager>(InGameManager.enGameManager.InGameObjManager).AddObj(0);
        Vector3 startpos = InGameManager.GetInstance().inGameLevelManager.gameMap.GetStartPosition();

        role.transform.position = GameCommon.GetWorldPos(startpos);
        role.SetZPos();

        InGameManager.GetInstance().inGameCameraManager.SetTarget(role.gameObject);

        for (int i = 0; i < rd.choseEquipList.Count; i++)
        {
            if (rd.choseEquipList[i] == -1) continue;
            EquipData edata = UserDataManager.instance.GetEquip(rd.choseEquipList[i]);
            role.AddEquip(edata);
        }

        //UserDataManager.instance.AddLevelupPoint(role.GetData().instanceid,5);
        role.ResetAllProperty(true);
        EventData.CreateEvent(EventID.EVENT_GAME_INITROLE).AddData(role).Send();

    }