private void Start() { guiAssemble = FsmVariables.GlobalVariables.GetFsmBool("GUIassemble"); functions = GetComponent <CDPlayerFunctions>(); sledpivot = transform.Find("Sled/cd_sled_pivot"); trigger = transform.Find("trigger_disc"); }
public static void AddCDplayer(GameObject SelectedVehicle, int Partname, bool RADIOCD, bool Channel) { CDPLAYER = GameObject.Instantiate <GameObject>(assetBundle.LoadAsset <GameObject>("CD_PLAYER.prefab")); CDPLAYER.transform.position = Vector3.zero; CDPLAYER.transform.eulerAngles = new Vector3(270f, 0f, 0f); handler = CDPLAYER.AddComponent <CDHandler>(); handler.Partname = Partname; var col = CDPLAYER.AddComponent <SphereCollider>(); col.radius = 0.1f; col.isTrigger = true; col.center = new Vector3(0f, -0.05f, 0f); functions = CDPLAYER.AddComponent <CDPlayerFunctions>(); functions.RADIOCD = RADIOCD; functions.Channel = Channel; CDPLAYER.AddComponent <InteractionRaycast>(); CDPLAYER.AddComponent <VolumeKnob>(); CDPLAYER.transform.SetParent(SelectedVehicle.transform, false); CDPLAYER.transform.localEulerAngles = Vector3.zero; if (SelectedVehicle.transform.Find("Radio") != null) { SelectedVehicle.transform.Find("Radio").gameObject.SetActive(false); } if (SelectedVehicle.transform.Find("Speaker") != null) { functions.sourcepivot = SelectedVehicle.transform.Find("Speaker"); } handler.GetCDfromLastSession(); Component.DestroyImmediate(functions.sourcepivot.GetComponent <PlayMakerFSM>()); }
public void Start() { Raycast = GetComponent <InteractionRaycast>(); Functions = GetComponent <CDPlayerFunctions>(); knob = transform.Find("Pivot/knob"); knobCollider = transform.Find("ButtonsCD/RadioVolume").GetComponent <SphereCollider>(); guiUse = PlayMakerGlobals.Instance.Variables.FindFsmBool("GUIuse"); guiInteraction = PlayMakerGlobals.Instance.Variables.FindFsmString("GUIinteraction"); knob.localEulerAngles = new Vector3(0f, -30 * KnobState, 0f); }