void Awake() { systems = GetComponentsInChildren <ShipSystem> (); autoWeaponSystem = GetComponentInChildren <AutoWeaponSystem> (); flightSystem = GetComponentInChildren <FlightSystem> (); detectionSystem = GetComponentInChildren <DetectionSystem> (); cargoSystem = GetComponentInChildren <CargoSystem> (); tradeSystem = GetComponentInChildren <TradeSystem> (); if (flightSystem != null) { flightSystem.MyBody = GetComponent <Rigidbody> (); // Ужас! } if (detectionSystem != null && autoWeaponSystem != null) { autoWeaponSystem.SubscribeToDetectionSystem(detectionSystem); } if (tradeSystem != null && cargoSystem != null) { tradeSystem.SubscribeToCargoSystem(cargoSystem); } }
public void SubscribeToCargoSystem(CargoSystem cargoSystem) { this.cargoSystem = cargoSystem; }