Пример #1
0
 public Unit(string sysId)
 {
     this._sysId = sysId;
     this._cfg = UnitManager.getInatance().getUnitCfgBySysId(sysId);
     // 先粘贴
     UnitAttribute = new CardAttribute();
     this._curHp = this._cfg.hitPoint;
     this._maxHp = this._cfg.hitPoint;
     //
     //unitSprite = new UnitUI(this, targetPosition);
     this._id = IDProvider.getInstance().applyUnitId(this);
     UnitManager.getInatance().registerUnit(this);
     this._buffList = new List<BuffDataDriven>();
     InterpreterManager.getInstance().registerLightUserData(this);
     this.initAttributes();
 }
Пример #2
0
    // todo : 弃用
    public Unit(int unitID, ChessboardPosition targetPosition)
    {
        this._curCell = Chessboard.GetCell(targetPosition);

        Skill_1 = null;
        Skill_2 = null;
        Skill_3 = null;

        switch (unitID)
        {
            case 1:
                Skill_1 = new Skill_1_1(this);
                Skill_2 = new Skill_1_2(this);
                break;
        }

        // Test
        this._sysId = "Unit_0001_01";
        this._cfg = UnitManager.getInatance().getUnitCfgBySysId(sysId);
        UnitAttribute = new CardAttribute();
        this._curHp = UnitAttribute.hp;
        this._maxHp = UnitAttribute.hp;
        //
        this.createUnitPrefab();
        Chessboard.addChildOnLayer(this._unitGo, BattleConsts.BattleFieldLayer_Unit, targetPosition.y, targetPosition.x);
        //unitSprite = new UnitUI(this, targetPosition);
        this._id = IDProvider.getInstance().applyUnitId(this);
        UnitManager.getInatance().registerUnit(this);
        this._buffList = new List<BuffDataDriven>();
        InterpreterManager.getInstance().registerLightUserData(this);
        this.setUpdateViewFlag(true);
        // 生成技能
        // test
        if ( a == 0 )
        {
            InterpreterManager.getInstance().initSkill("skill1", this);
            a = 1;
        }
        this.initAttributes();
    }