Ejemplo n.º 1
0
 private UnitData GetCurrentUnitData() {
     var data = view.data;
     if (cachedUnitData.ContainsKey(data.level)) {
         return cachedUnitData[data.level];
     }
     UnitData unitData = new UnitData();
     for (int i = 0; i < data.level; i++) {
         unitData += data.upgradeData[i].unitDeltaStats;
     }
     return unitData;
 }
Ejemplo n.º 2
0
 public IUnit CreateUnit(Vector3 position, UnitTypes type, UnitData data, bool isDefender) {
     IUnit unit;
     if (type == UnitTypes.HERO) {
         unit = new HeroModel();
     } else {
         unit = new UnitModel();
     }
     InjectionBinder.injector.Inject(unit);
     unit.Spawn(position, data, type, isDefender);
     unit.InitializeStates();
     unit.StartAct();
     return unit;
 }
Ejemplo n.º 3
0
 public UnitData Copy() {
     UnitData newUnitData = new UnitData {
         health = health,
         armor = armor,
         damage = damage,
         attackSpeed = attackSpeed,
         movementSpeed = movementSpeed,
         attackRange = attackRange,
         vulnerabilityRadius = vulnerabilityRadius,
         goldPrice = goldPrice,
         xpPrice = xpPrice
     };
     return newUnitData;
 }
Ejemplo n.º 4
0
 public static UnitData operator +(UnitData first, UnitData second) {
     UnitData newUnitData = new UnitData {
         health = first.health + second.health,
         armor = first.armor + second.armor,
         damage = first.damage + second.damage,
         attackSpeed = first.attackSpeed + second.attackSpeed,
         movementSpeed = first.movementSpeed + second.movementSpeed,
         attackRange = first.attackRange + second.attackRange,
         vulnerabilityRadius = first.vulnerabilityRadius + second.vulnerabilityRadius,
         goldPrice = first.goldPrice + second.goldPrice,
         xpPrice = first.xpPrice + second.xpPrice
     };
     return newUnitData;
 }