public void InitAttr(int carAttrID, int type)
    {
        CAR_ATTR car = DataCfgMgr.instance.GetCar(carAttrID);

        if (car == null)
        {
            Debug.LogError("AttrCom car == null carAttrID:" + carAttrID.ToString());
            return;
        }
        SetAttr((int)Const_Util.UNIT_ATTR.MOVE_BASE_SPEED, 0.0f, Vector3.zero);
        SetAttr((int)Const_Util.UNIT_ATTR.MOVE_CUR_SPEED, 0.0f, Vector3.zero);
        SetAttr((int)Const_Util.UNIT_ATTR.NITROGEN_MAX, car.nitrogen, Vector3.zero);
        SetAttr((int)Const_Util.UNIT_ATTR.NITROGEN_CUR, 0, Vector3.zero);
        SetAttr((int)Const_Util.UNIT_ATTR.UNIT_TYPE, type, Vector3.zero);
    }
예제 #2
0
    List <BattleUnit> SpawnPlayerUnit(int playerIdx, int heroCarID, Transform hangNode, int unitType)
    {
        HERO_CAR heroCar   = DataCfgMgr.instance.GetHeroCar(heroCarID);
        int      unitResID = (int)heroCar.car_id;


        List <BattleUnit> objList = new List <BattleUnit>();

        CAR_ATTR     car         = DataCfgMgr.instance.GetCar(unitResID);
        int          carPosID    = playerIdx;
        CAR_POS      carPos      = DataCfgMgr.instance.GetCarPos(carPosID);//
        CAR_VELOCITY carVelocity = DataCfgMgr.instance.GetCarVelocity((int)(heroCar.velocity_id));
        CAR_POS      carPosY     = DataCfgMgr.instance.GetCarPos((int)(heroCar.pos_id));

        BattleUnit obj = SpawnOneUnit(playerIdx, heroCarID, car.res_path, hangNode, new Vector2(carPos.car_pos.x, carPosY.car_pos.y),
                                      new Vector2(carVelocity.car_velocity.x, carVelocity.car_velocity.y), unitType);

        objList.Add(obj);
        return(objList);
    }
예제 #3
0
    List <BattleUnit> SpawnNPCUnit(int playerIdx, int waveID, Transform hangNode, int unitType)
    {
        List <BattleUnit> objList   = new List <BattleUnit>();
        BRUSH_CAR         brushInfo = DataCfgMgr.instance.GetBrushCar(waveID);

        if (brushInfo == null)
        {
            return(null);
        }

        for (int i = 0; i < brushInfo.car_list.Count; i++)
        {
            int          carID       = (int)(brushInfo.car_list[i].car_id);
            CAR_ATTR     car         = DataCfgMgr.instance.GetCar(carID);
            CAR_POS      carPos      = DataCfgMgr.instance.GetCarPos((int)(brushInfo.car_list[i].pos_id));
            CAR_VELOCITY carVelocity = DataCfgMgr.instance.GetCarVelocity((int)(brushInfo.car_list[i].velocity_id));
            BattleUnit   obj         = SpawnOneUnit(playerIdx, carID, car.res_path, hangNode, new Vector2(carPos.car_pos.x, carPos.car_pos.y),
                                                    new Vector2(carVelocity.car_velocity.x, carVelocity.car_velocity.y), unitType);
            objList.Add(obj);
        }
        return(objList);
    }