Ejemplo n.º 1
0
    public static void CreateBattleBullet(DataConfig.BULLET_TYPE type, UnitFire.ShootParam shoot)
    {
        string resName = AppConfig.FOLDER_PROFAB + "bullet/bullet" + (int)type;

        GameObject obj = ResourceHelper.Load(resName);

        AddUnitToLayer(obj, BattleConfig.LAYER.BULLET);

        obj.GetComponent <Bullet> ().Create(shoot);
    }
Ejemplo n.º 2
0
    public void Load(LitJson.JSONNode json)
    {
        id = int.Parse(json["ID"]);

        battleParam = new BasicBattleParam();
        battleParam.Load(json);

        name       = json["Name"];
        asset      = json["Asset"];
        bulletType = (DataConfig.BULLET_TYPE) int.Parse(json ["CannonType"]);
        bodyType   = (DataConfig.BODY_TYPE) int.Parse(json ["BodyType"]);
        quality    = JsonReader.Int(json, "Quality");

        targetSelect = (DataConfig.TARGET_SELECT)JsonReader.Int(json, "targetSelect");
        shootCD      = JsonReader.Float(json, "shootCD");    //5;

        shootRange = JsonReader.Float(json, "shootRange");   //150;
        closeRange = JsonReader.Float(json, "closeRange");   //80;
        fightRange = JsonReader.Float(json, "fightRange");   //40;
//		Assert.assert (shootRange >= closeRange);
        Assert.assert(closeRange >= fightRange);

        stopToFire      = true;                                      //int.Parse (json ["stopToFire"]) != 0;
        canStandTurn    = JsonReader.Int(json, "canStandTurn") != 0;
        firePrepareTime = JsonReader.Float(json, "firePrepareTime"); //1;
        damageRange     = JsonReader.Float(json, "damageRange");
        length          = JsonReader.Float(json, "length");          //7;
        Assert.assert(length <= MapGrid.GRID_SIZE);
        breakTime = JsonReader.Float(json, "breakTime");             //2;
        speed     = float.Parse(json ["Speed"]);

        costCdCash = JsonReader.Float(json, "CdCash");

        fireCount    = int.Parse(json ["FireCount"]);
        fireInterval = float.Parse(json ["FireInterval"]);
//		shootInterval = float.Parse (json ["ShootInterval"]);
//		targetsPerFire = int.Parse (json ["TargetsPerFire"]);
//		targetsSelectType = (DataConfig.TARGETS_SELECT_TYPE)int.Parse (json ["TargetSelectType"]);

        string str_partsId = json["PartsID"];

        partsId = StringHelper.ReadIntArrayFromString(str_partsId);

        cost = new BasicCost();
        cost.Load(json);

        buildingLevel = int.Parse(json ["BuildingLevel"]);

        repairRate = float.Parse(json ["RepairRate"]);

        chipId    = JsonReader.Int(json, "ChipID");
        chipCount = JsonReader.Int(json, "ChipCount");
    }