void Start() { reaktor = Reaktor.SearchAvailableFrom (gameObject); initialPosition = transform.localPosition; initialRotation = transform.localRotation; initialScale = transform.localScale; }
void Awake() { m_Instance = this; Shader.DisableKeyword("AUDIO_REACTIVE"); if (!m_AudioInput) { Debug.LogWarning("No audio input set for audio reactivity. Add a VisualizerAudioInput script.", gameObject); gameObject.SetActive(false); return; } // Two channels, 512 values. m_FFT = new CSCore.DSP.FftProvider(1, CSCore.DSP.FftSize.Fft512); m_FFTResult = new float[FFT_SIZE]; m_PeakFFTResult = new float[FFT_SIZE]; m_BandLevels = new float[m_Bands.Length]; m_BandPeakLevels = new float[m_Bands.Length]; m_BandNormalizedLevels = new float[m_Bands.Length]; m_WaveFormTexture = new Texture2D(FFT_SIZE, 1, TextureFormat.ARGB32, true); m_WaveFormTexture.SetPixels32(new Color32[FFT_SIZE]); m_WaveFormRow = new Color[FFT_SIZE]; m_FFTTexture = new Texture2D(m_FFTTextureSize, 1, TextureFormat.ARGB32, true); m_FFTTexture.SetPixels32(new Color32[m_FFTTextureSize]); m_FFTRow = new Color[m_FFTTextureSize]; // Visualization m_BandPeakLevelsOutput = Vector4.zero; m_BeatOutput = Vector4.zero; m_BeatOutputAccum = Vector4.zero; m_AudioVolume = Vector4.zero; // m_LChannelWeird is a quasi-interpolated waveform used on for shader visuals m_LChannelWeird = new float[FFT_SIZE]; m_LChannelHighPass = new float[FFT_SIZE]; m_LChannelLowPass = new float[FFT_SIZE]; m_AudioSamples = new float[FFT_SIZE]; m_Reaktor = m_SystemAudioInjector.GetComponent <Reaktor>(); m_ReaktorAlt = m_SystemAudioInjectorAlt.GetComponent <Reaktor>(); m_ReaktorLowPass = m_SystemAudioInjectorLowPass.GetComponent <Reaktor>(); m_ReaktorHighPass = m_SystemAudioInjectorHighPass.GetComponent <Reaktor>(); m_AudioCaptureRequested = false; m_VisualsRequested = false; m_VisualsActive = false; }
void Awake() { m_Instance = this; m_VisualizerObjects = new List <GameObject>(); Shader.DisableKeyword("AUDIO_REACTIVE"); // Two channels, 512 values. #if DISABLE_AUDIO_CAPTURE m_FFT = new Fft(); #else m_FFT = new VisualizerCSCoreFft(1, 512); #endif m_FFTResult = new float[m_FFTSize]; m_PeakFFTResult = new float[m_FFTSize]; m_BandLevels = new float[m_Bands.Length]; m_BandPeakLevels = new float[m_Bands.Length]; m_BandNormalizedLevels = new float[m_Bands.Length]; m_WaveFormTexture = new Texture2D(m_FFTSize, 1, TextureFormat.ARGB32, true, true); m_WaveFormTexture.SetPixels32(new Color32[m_FFTSize]); m_WaveFormRow = new Color[m_FFTSize]; m_FFTTexture = new Texture2D(m_FFTTextureSize, 1, TextureFormat.ARGB32, true, true); m_FFTTexture.SetPixels32(new Color32[m_FFTTextureSize]); m_FFTRow = new Color[m_FFTTextureSize]; // Visualization m_BandPeakLevelsOutput = Vector4.zero; m_BeatOutput = Vector4.zero; m_BeatOutputAccum = Vector4.zero; m_AudioVolume = Vector4.zero; // m_LChannelWeird is a quasi-interpolated waveform used on for shader visuals m_LChannelWeird = new float[m_FFTSize]; m_LChannelHighPass = new float[m_FFTSize]; m_LChannelLowPass = new float[m_FFTSize]; m_AudioSamples = new float[m_FFTSize]; m_Reaktor = m_SystemAudioInjector.GetComponent <Reaktor>(); m_ReaktorAlt = m_SystemAudioInjectorAlt.GetComponent <Reaktor>(); m_ReaktorLowPass = m_SystemAudioInjectorLowPass.GetComponent <Reaktor>(); m_ReaktorHighPass = m_SystemAudioInjectorHighPass.GetComponent <Reaktor>(); m_VisualsRequestCount = 0; m_VisualsActive = false; }
// Draw the input level bar. void DrawLevelBar(Reaktor reaktor) { if (barTextures == null) { // Make textures for drawing level bars. barTextures = new Texture2D[] { NewBarTexture (Color.red), NewBarTexture (Color.green), NewBarTexture (Color.blue), NewBarTexture (Color.gray) }; } // Peak level label. EditorGUILayout.LabelField ("Peak Level", reaktor.Peak.ToString ("0.0") + " dB"); // Get a rectangle as a text field. var rect = GUILayoutUtility.GetRect (18, 10, "TextField"); var width = rect.width; // Fill the rectangle with gray. GUI.DrawTexture (rect, barTextures [3]); // Draw the range bar with red. rect.x += width * (reaktor.Peak - reaktor.lowerBound - reaktor.dynamicRange - reaktor.headroom) / (3 - reaktor.lowerBound); rect.width = width * (reaktor.dynamicRange + reaktor.headroom) / (3 - reaktor.lowerBound); GUI.DrawTexture (rect, barTextures [0]); // Draw the effective range bar with green. rect.width = width * (reaktor.dynamicRange) / (3 - reaktor.lowerBound); GUI.DrawTexture (rect, barTextures [1]); // Draw the output level bar with blue. rect.width = width * reaktor.dynamicRange * reaktor.Output / (3 - reaktor.lowerBound); rect.y += rect.height / 2; rect.height /= 2; GUI.DrawTexture (rect, barTextures [2]); }
// Draw the input level bar. void DrawLevelBar(Reaktor reaktor) { if (barTextures == null) { // Make textures for drawing level bars. barTextures = new Texture2D[] { NewBarTexture(Color.red), NewBarTexture(Color.green), NewBarTexture(Color.blue), NewBarTexture(Color.gray) }; } // Peak level label. EditorGUILayout.LabelField("Peak Level", reaktor.Peak.ToString("0.0") + " dB"); // Get a rectangle as a text field. var rect = GUILayoutUtility.GetRect(18, 10, "TextField"); var width = rect.width; // Fill the rectangle with gray. GUI.DrawTexture(rect, barTextures [3]); // Draw the range bar with red. rect.x += width * (reaktor.Peak - reaktor.lowerBound - reaktor.dynamicRange - reaktor.headroom) / (3 - reaktor.lowerBound); rect.width = width * (reaktor.dynamicRange + reaktor.headroom) / (3 - reaktor.lowerBound); GUI.DrawTexture(rect, barTextures [0]); // Draw the effective range bar with green. rect.width = width * (reaktor.dynamicRange) / (3 - reaktor.lowerBound); GUI.DrawTexture(rect, barTextures [1]); // Draw the output level bar with blue. rect.width = width * reaktor.dynamicRange * reaktor.Output / (3 - reaktor.lowerBound); rect.y += rect.height / 2; rect.height /= 2; GUI.DrawTexture(rect, barTextures [2]); }
private void prikazOstalog(IKomponenta komponentaObj) { Trup trup = ((TagTekst <Trup>)cbOpVelicine.SelectedItem).tag; int indeks = lstOprema.SelectedIndices[0]; Dictionary <string, ITekst> jezik = Postavke.Jezik[Kontekst.FormFlote]; Dictionary <string, ITekst> jezikTech = Postavke.Jezik[Kontekst.FormTech]; StringBuilder sb = new StringBuilder(txtOpOpis.Text); sb.AppendLine(); sb.AppendLine(); if (indeks < opremaOstaloZadnjiIndeks[0]) { cbOpVelicine.Visible = false; Oklop oklop = (Oklop)komponentaObj; sb.AppendLine(jezik["opisOklopIzd"].tekst() + ": x" + oklop.izdrzljivost.ToString("0.##")); sb.AppendLine(jezik["opisOklopUblKoef"].tekst() + ": " + oklop.ublazavanjeSteteKoef.ToString("0.##")); sb.AppendLine(jezik["opisOklopUblMax"].tekst() + ": x" + oklop.ublazavanjeSteteMax.ToString("0.##")); } else if (indeks < opremaOstaloZadnjiIndeks[1]) { cbOpVelicine.Visible = true; MZPogon pogon = (MZPogon)komponentaObj; pogon = pogon.info.naciniKomponentu(pogon.nivo, trup.VelicinaMZPogona); jezik = jezikTech; if (trup.VelicinaMZPogona >= pogon.info.minimalnaVelicina(pogon.nivo)) { sb.AppendLine(jezik["opMZbrzina"].tekst() + ": " + pogon.brzina.ToString("0.###")); sb.AppendLine(); sb.AppendLine(jezik["opCijena"].tekst() + ": " + Fje.PrefiksFormater(pogon.cijena)); sb.AppendLine(jezik["opSnaga"].tekst() + ": " + Fje.PrefiksFormater(pogon.snaga)); sb.AppendLine(jezik["opVelicina"].tekst() + ": " + Fje.PrefiksFormater(trup.VelicinaMZPogona)); } else { sb.AppendLine(jezik["opMinVel"].tekst() + ": " + Fje.PrefiksFormater(pogon.info.minimalnaVelicina(pogon.nivo))); sb.AppendLine(jezik["opNeStane"].tekst()); } } else if (indeks < opremaOstaloZadnjiIndeks[2]) { cbOpVelicine.Visible = false; Potisnici potisnici = (Potisnici)komponentaObj; sb.AppendLine(jezik["opisPokret"].tekst() + ": " + Fje.PrefiksFormater(potisnici.brzina)); } else if (indeks < opremaOstaloZadnjiIndeks[3]) { cbOpVelicine.Visible = true; Reaktor reaktor = (Reaktor)komponentaObj; reaktor = reaktor.info.naciniKomponentu(reaktor.nivo, trup.VelicinaReaktora); sb.AppendLine(jezikTech["opMinVel"].tekst() + ": " + Fje.PrefiksFormater(reaktor.info.minimalnaVelicina(reaktor.nivo))); if (trup.VelicinaReaktora >= reaktor.info.minimalnaVelicina(reaktor.nivo)) { sb.AppendLine(jezik["opisReaktorDost"].tekst() + ": " + Fje.PrefiksFormater(reaktor.snaga)); } else { sb.AppendLine(jezikTech["opNeStane"].tekst()); } } else if (indeks < opremaOstaloZadnjiIndeks[4]) { cbOpVelicine.Visible = false; Senzor senzor = (Senzor)komponentaObj; sb.AppendLine(jezik["opisSenzorSn"].tekst() + ": " + Fje.PrefiksFormater(senzor.razlucivost)); } txtOpOpis.Text = sb.ToString(); }
void Start() { reaktor = Reaktor.SearchAvailableFrom(gameObject); }
void Start() { reaktor = Reaktor.SearchAvailableFrom (gameObject); time = counter++ * -interval; }
void Start() { reaktor = Reaktor.SearchAvailableFrom (gameObject); animator = GetComponent<Animator> (); }
void Start() { reaktor = Reaktor.SearchAvailableFrom (gameObject); }
void Start() { audio = gameObject.GetComponent <Reaktor> (); }
void Start() { reaktor = Reaktor.SearchAvailableFrom(gameObject); animator = GetComponent <Animator> (); }
// Draw the input level bar. void DrawInputLevelBars(Reaktor reaktor) { if (barTextures == null) { // Make textures for drawing level bars. barTextures = new Texture2D[] { NewBarTexture (new Color (55.0f / 255, 53.0f / 255, 45.0f / 255)), NewBarTexture (new Color (250.0f / 255, 249.0f / 255, 248.0f / 255)), NewBarTexture (new Color (110.0f / 255, 192.0f / 255, 91.0f / 255, 0.8f)), NewBarTexture (new Color (226.0f / 255, 0, 7.0f / 255, 0.8f)), NewBarTexture (new Color (249.0f / 255, 185.0f / 255, 22.0f / 255)) }; } // Get a rectangle as a text field and fill it. var rect = GUILayoutUtility.GetRect (18, 16, "TextField"); GUI.DrawTexture (rect, barTextures [0]); // Draw the raw input bar. var temp = rect; temp.width *= Mathf.Clamp01 ((reaktor.RawInput - reaktor.lowerBound) / (3 - reaktor.lowerBound)); GUI.DrawTexture (temp, barTextures [1]); // Draw the dynamic range. temp.x += rect.width * (reaktor.Peak - reaktor.lowerBound - reaktor.dynamicRange - reaktor.headroom) / (3 - reaktor.lowerBound); temp.width = rect.width * reaktor.dynamicRange / (3 - reaktor.lowerBound); GUI.DrawTexture (temp, barTextures [2]); // Draw the headroom. temp.x += temp.width; temp.width = rect.width * reaktor.headroom / (3 - reaktor.lowerBound); GUI.DrawTexture (temp, barTextures [3]); // Display the peak level value. EditorGUI.LabelField (rect, "Peak: " + reaktor.Peak.ToString ("0.0") + " dB"); // Draw the gain level. if (reaktor.gainEnabled) DrawLevelBar ("Gain", reaktor.Gain, barTextures [0], barTextures [1]); // Draw the offset level. if (reaktor.offsetEnabled) DrawLevelBar ("Offset", reaktor.Offset, barTextures [0], barTextures [1]); // Draw the output level. DrawLevelBar ("Out", reaktor.Output, barTextures [0], barTextures [4]); }
public Erőmű(ErőműÉpítő építő) { reaktor = építő.ReaktorLétrehozása(); vezpult = építő.VezérlőpultLétrehozása(); }
public override void Vezérel(Reaktor r) { Console.WriteLine( "Ezt a {0}-t jól beszabályozom.", r.GetType().Name); }
public override void Vezérel(Reaktor r) { Console.WriteLine( "Találtam egy {0}-t, mit csináljak?", r.GetType().Name); }
public abstract void Vezérel(Reaktor r);
void Awake() { m_Reaktor = GetComponent <Reaktor>(); }
void Start() { reaktor = Reaktor.SearchAvailableFrom(gameObject); time = counter++ *-interval; }
IEnumerator Start() { #if UNITY_EDITOR DestroyPreview(); #endif if (Application.isPlaying) { if (transform.childCount > 0) { Destroy(transform.GetChild(0).gameObject); } m_Frames = new List <GameObject> (); foreach (var f in m_FrameSources) { for (int i = 0; i < f.Duration; i++) { GameObject o; if (f.m_Source != null) { o = Instantiate(f.m_Source) as GameObject; o.transform.position = f.m_Source.transform.position; o.transform.eulerAngles = f.m_Source.transform.eulerAngles; o.transform.localScale = f.m_Source.transform.lossyScale; o.transform.SetParent(transform, true); o.name = f.m_Source.name; if (f.m_SourceType == SourceType.SceneGameObject) { f.m_Source.SetActive(false); } else { o.transform.localPosition = Vector3.zero; o.transform.localEulerAngles = Vector3.zero; o.transform.localScale = Vector3.one; } } else { o = new GameObject("(Empty frame)"); o.transform.SetParent(transform); } o.SetActive(false); m_Frames.Add(o); } } if (m_PlaybackMode == PlaybackMode.Constant) { _counter = 1f / m_ConstantFramesPerSecond; if (m_RandomizeStart) { m_Current = Random.Range(0, m_Frames.Count - 1); } } m_Frames [m_Current].SetActive(true); yield return(new WaitForSeconds(0.25f)); m_Reaktor = FindObjectOfType <Reaktor> (); if (m_PlaybackMode == PlaybackMode.EveryBeat && m_Reaktor == null) { Debug.LogError("No audio reactivity found. Add the [TiltBrush Audio Reactivity] prefab to the scene.", this); } } }