|
@@ -80,21 +80,46 @@ public class EnemyCreater : MonoBehaviour
|
|
|
}
|
|
}
|
|
|
for (int i = 0; i < cfgCreateBuilding.Count; i++)
|
|
for (int i = 0; i < cfgCreateBuilding.Count; i++)
|
|
|
{
|
|
{
|
|
|
- if (!createdBuilding[i]
|
|
|
|
|
- &&(cfgCreateBuilding[i].Type == 0 && cfgCreateBuilding[i].Time - portalsCreateTime <= gameTime
|
|
|
|
|
- ||cfgCreateBuilding[i].Type == 1 && cfgCreateBuilding[i].Time <= gameTime))
|
|
|
|
|
|
|
+ if(cfgCreateBuilding[i].RefreshBuildingID == 0)
|
|
|
{
|
|
{
|
|
|
- createdBuilding[i] = true;
|
|
|
|
|
- if(gameTime< portalsCreateTime)
|
|
|
|
|
|
|
+ if (!createdBuilding[i]
|
|
|
|
|
+ && (cfgCreateBuilding[i].Type == 0 && cfgCreateBuilding[i].Time - portalsCreateTime <= gameTime
|
|
|
|
|
+ || cfgCreateBuilding[i].Type == 1 && cfgCreateBuilding[i].Time <= gameTime))
|
|
|
{
|
|
{
|
|
|
- StartCreateBuilding(i, cfgCreateBuilding[i].Time);
|
|
|
|
|
|
|
+ createdBuilding[i] = true;
|
|
|
|
|
+ if (gameTime < portalsCreateTime)
|
|
|
|
|
+ {
|
|
|
|
|
+ StartCreateBuilding(i, cfgCreateBuilding[i].Time);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ StartCreateBuilding(i, portalsCreateTime);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
- else
|
|
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ GameObject result = null;
|
|
|
|
|
+ buildingDic.TryGetValue(cfgCreateBuilding[i].RefreshBuildingID, out result);
|
|
|
|
|
+ if (result != null)
|
|
|
{
|
|
{
|
|
|
- StartCreateBuilding(i, portalsCreateTime);
|
|
|
|
|
|
|
+ EnemyTower enemyTower = result.GetComponent<EnemyTower>();
|
|
|
|
|
+ if (enemyTower.hp * 100 <= enemyTower.totalHp * cfgCreateBuilding[i].RefreshBuildingHP && !createdBuilding[i])
|
|
|
|
|
+ {
|
|
|
|
|
+ createdBuilding[i] = true;
|
|
|
|
|
+ if (gameTime < portalsCreateTime)
|
|
|
|
|
+ {
|
|
|
|
|
+ StartCreateBuilding(i, cfgCreateBuilding[i].Time);
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ StartCreateBuilding(i, portalsCreateTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -113,7 +138,7 @@ public class EnemyCreater : MonoBehaviour
|
|
|
break;
|
|
break;
|
|
|
case 1:
|
|
case 1:
|
|
|
Vector3 positon = new Vector3(singleCreateBuilding.Position[0], singleCreateBuilding.Position[1], singleCreateBuilding.Position[2]);
|
|
Vector3 positon = new Vector3(singleCreateBuilding.Position[0], singleCreateBuilding.Position[1], singleCreateBuilding.Position[2]);
|
|
|
- CreateEnemyTower(singleCreateBuilding.ID,singleCreateBuilding.BuildingID, singleCreateBuilding.HPRatio, singleCreateBuilding.AttackRatio, positon);
|
|
|
|
|
|
|
+ CreateEnemyTower(singleCreateBuilding.ID, singleCreateBuilding.BuildingID, singleCreateBuilding.HPRatio, singleCreateBuilding.AttackRatio, positon);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|