private void ChangeScene(Scene prev, Scene next) { if (!firstSectorStarted) { return; } //flooded loop for (int i = 0; i < floodedTiles.Count; i++) { Destroy(floodedTiles[i].gameObject); } floodedTiles.Clear(); string woodReport = ""; if (carpentersQuaters.isManned) { int crewRepairAmount = carpentersQuaters.tile.crewMem.endSectorRepairAmount; int needToRepair = (maxHealth - health) >= crewRepairAmount ? crewRepairAmount : maxHealth - health; int woodAvailableToUse = CanAfford(0, needToRepair, 0) ? needToRepair : wood; if (woodAvailableToUse > 0) { Spend(0, woodAvailableToUse, 0, false); Heal(woodAvailableToUse); woodReport += "Ship was repaired for " + woodAvailableToUse + " by using " + woodAvailableToUse + " wood. "; } } //food and doctor loop string doctorReport = ""; string foodReport = ""; if (doctorsQuaters.isManned) { for (int i = 0; i < crewMembers.Count; i++) { CrewMember c = crewMembers[i]; int healed = 0; bool starve = false; bool died = false; if (food > 0) { food = Mathf.Clamp(food - 2, 0, int.MaxValue); healed = c.Heal(doctorsQuaters.tile.crewMem.healingAbility); } else { starve = true; if (c.health < 4) { healed = c.Heal(doctorsQuaters.tile.crewMem.healingAbility); died = c.TakeDamage(4); } else { died = c.TakeDamage(4); healed = c.Heal(doctorsQuaters.tile.crewMem.healingAbility); } } if (healed > 0) { doctorReport += c.personName + " was healed for " + (healed) + ". "; } if (died) { foodReport += c.personName + " has died from starvation. "; i--; } else if (starve) { foodReport += c.personName + " has taken 4 damage due to starvation. "; } } } if (food == 0) { foodReport = "We have run out of food! " + foodReport; } else { foodReport = "We have used " + (crewMembers.Count * 2) + " food. "; } sectorEndReport = foodReport + doctorReport + woodReport; //TODO: training happen before stats updated maybe? for (int i = 0; i < crewMembers.Count; i++) { switch (crewMembers[i].role) { case CrewMember.Role.CAPTAIN: crewMembers[i].dexterity += 1; crewMembers[i].intelligence += 1; break; case CrewMember.Role.NAVIGATOR: case CrewMember.Role.DOCTOR: crewMembers[i].intelligence += 1; break; case CrewMember.Role.BAILER: case CrewMember.Role.CARPENTER: case CrewMember.Role.CANNONEER: crewMembers[i].dexterity += 1; break; } } }