public SignDefinition(StationSignType type, float x, float y, float z, float normX, float normZ) { SignType = type; Position = new Vector3(x, y, z); Vector3 forward = new Vector3(normX, 0, normZ); // y comp always 0 Rotation = Quaternion.FromToRotation(Vector3.forward, forward); }
public void AddSign(GameObject signObject, StationSignType signType) { SignObjects.Add(signObject); // Job displays SignPrinter newDisplay = signObject.AddComponent <SignPrinter>(); if (newDisplay != null) { newDisplay.Initialize(signType); newDisplay.UpdateDisplay(new SignData(PlatformTrack.logicTrack.ID.TrackPartOnly, "12:00")); DisplayComponents.Add(newDisplay); } else { PassengerJobs.ModEntry.Logger.Warning("Couldn't add SignPrinter component to station sign object"); } signObject.SetActive(SignsActive); }
public void Initialize(StationSignType signType) { SignComp[] comps = SignPrefabComps[signType]; Signs = new SignTextConfig[comps.Length]; for (int i = 0; i < comps.Length; i++) { // find the text field with given name if (gameObject.transform.Find(comps[i].Item1)?.GetComponent <TextMeshPro>() is TextMeshPro tmp) { Signs[i] = new SignTextConfig() { TextRenderer = tmp, Type = comps[i].Item2 }; //PassengerJobs.ModEntry.Logger.Log($"Found comp {tmp.name}"); } else { Signs[i] = null; PassengerJobs.ModEntry.Logger.Log($"Failed to find {comps[i].Item1} comp on {gameObject.name}, {signType}"); } } }