public bool AddGear(ShipGear gear) { if (Gears.Count >= 10) { return(false); } else { Gears.Add(gear); return(true); } }
static public void PlusGearStates(ref ShipGear gearA, ShipGear gearB) { gearA.MaxArmour += gearB.MaxArmour; gearA.MaxSpeed += gearB.MaxSpeed; gearA.Acceleration += gearB.Acceleration; gearA.TurningSpeed += gearB.TurningSpeed; gearA.CannonAtk += gearB.CannonAtk; gearA.StrikeAtk += gearB.StrikeAtk; gearA.CannonCapacity += gearB.CannonCapacity; gearA.MaxMorale += gearB.MaxMorale; gearA.WeaponNum += gearB.WeaponNum; gearA.MaxCrewNum += gearB.MaxCrewNum; }
void ShowShipStats(Ship ship) { ShipGear data = ship.ShipData; // Debug.Log("ShipID === " + data.GearUID); // Debug.Log("name === " + data.Name); // Debug.Log("maxArmour === " + data.MaxArmour); // Debug.Log("maxSpeed === " + data.MaxSpeed); // Debug.Log("acceleration === " + data.Acceleration); // Debug.Log("cannonAtk === " + data.CannonAtk); // Debug.Log("cannonCapacity === " + data.CannonCapacity); // Debug.Log("turningSpeed === " + data.TurningSpeed); // Debug.Log("strikeAtk === " + data.StrikeAtk); // Debug.Log("cannonNum === " + data.WeaponNum); // Debug.Log("crewNum === " + data.MaxCrewNum); }
void RefreshData(IEnumerable <ShipGear> newGears) { /*釋放記憶體? 不確定是否多餘*/ State = null; State = new ShipGear(); foreach (ShipGear gear in newGears) { State.MaxArmour += gear.MaxArmour; State.MaxSpeed += gear.MaxSpeed; State.TurningSpeed += gear.TurningSpeed; State.Acceleration += gear.Acceleration; State.CannonAtk += gear.CannonAtk; State.CannonCapacity += gear.CannonCapacity; State.WeaponNum += gear.WeaponNum; State.StrikeAtk += gear.StrikeAtk; State.MaxMorale += gear.MaxMorale; State.MaxCrewNum += gear.MaxCrewNum; } }