public void BuildShip(UnderConstruction f, Empire e) { InstantiateFleet fleet = new InstantiateFleet(); CreateConstruction b = new CreateConstruction(f, e); e.construction.Add(b); b.Start(); //e.underConstruction.Remove(f); }
public CreateConstruction(UnderConstruction f, Empire e) { float modifier = 0; under = f.f; emp = e; system = emp.getHomeworldPlanet().getSystem(); InstantiateFleet fleet = new InstantiateFleet(); id = f.id; name = f.f.name + "-" + id; type = f.f.name; model = f.f.model; acceleration = f.f.acceleration; maxSpeed = f.f.maxSpeed; targetSpeed = f.f.targetSpeed; level = f.f.level; maxCrew = f.f.maxCrew; firepower = f.f.firepower * (f.f.level + 1); horsepower = f.f.horsepower; TransportCap = f.f.TransportCap * (f.f.level + 1);; maintenance = f.f.maintenance * (f.f.level + 1); if (emp.hasAttribute(32)) { float mod2 = Attributes.getAttribute(32).attrValue2; maintenance += maintenance * mod2; } cost = f.f.cost * (f.f.level + 1); maxHealth = f.f.maxHealth * (f.f.level + 1); if (emp.hasAttribute(66)) { float mod2 = Attributes.getAttribute(66).attrValue; maxHealth += Mathf.RoundToInt(maxHealth * mod2); } daysToBuild = f.f.daysToBuild; health = maxHealth; crew = maxCrew; marines = 0; army = 0; rotateModel = f.f.rotateModel; shipClass = f.f.shipClass; }
public void BuyShip(int i, Empire e) { InstantiateFleet fleet = new InstantiateFleet(); float modifier = 0; float daysToBuild = fleet.getByID(i).daysToBuild; double cost = 0; if (fleet.getByID(i).name == "Cruiser") { if (e.hasAttribute(32)) { return; // cannot build due to attribute 23 (Inferior Navy) } } if (fleet.getByID(i).name == "Warpship") { if (!e.getHomeworldPlanet().getConstruction(19)) { return; // can't build due to not having a warp gate } } if (fleet.getByID(i).name == "Battlecruiser") { if (e.getHomeworldPlanet().getConstruction(3)) { float mod2 = Construction.getConstruction(3).attrValue; modifier += mod2; } } if (e.hasAttribute(12)) { float mod2 = Attributes.getAttribute(12).attrValue; modifier += mod2; } daysToBuild += (daysToBuild * modifier); modifier = 0; Debug.Log(e.getActiveNavy()); //if (e.getActiveNavy() >= fleet.getByID(i).maxCrew) //{ e.changeDeployedNavy(fleet.getByID(i).maxCrew, false); cost = fleet.getByID(i).cost; if (e.hasAttribute(47)) { float mod2 = Attributes.getAttribute(47).attrValue; modifier += mod2; } if (e.hasAttribute(32)) { float mod2 = Attributes.getAttribute(32).attrValue; modifier += mod2; } cost += (cost * modifier); e.getPlayer().changeTreasury(-cost); e.underConstruction.Add(new UnderConstruction(fleet.getByID(i), shipNum, daysToBuild)); shipNum++; //} }