/* * System generation methods */ private void SpawnShip() { // Get the position of the new ship Vector2 pos = new Vector2(Random.Range(0, planetSeperationDistance), Random.Range(0, planetSeperationDistance)); pos += (Vector2)transform.position; // Create the ship from the prefab template and set its position GameObject newShip = Instantiate(shipTemplate); newShip.transform.position = pos; AssetLoader assets = FindObjectOfType <AssetLoader>(); // Set the ship's data from json Ship shipComponent = newShip.GetComponent <Ship>(); JsonUtility.FromJsonOverwrite(assets.shipData ["namean"], shipComponent); // Add it as an employee to the company Employee e = newShip.GetComponent <Employee>(); transportCompany.AddEmployee(e); // Set up which contract types this employee can accept e.AddAcceptedContractType <FreightContract>(); }