void Start() { _onStartEvent.Invoke(); _onEnabledEvent.Invoke(); _hasStarted = true; }
void Update() { // Invoke events in the queue. lock (_eventQueue) while (_eventQueue.Count > 0) { switch (_eventQueue.Dequeue()) { case EventRecord.Bang: _bangEvent.Invoke(); break; case EventRecord.On: _onEvent.Invoke(); break; case EventRecord.Off: _offEvent.Invoke(); break; } } // Value interpolation and invokation. _valueEvent.Invoke(_value.Step()); #if UNITY_EDITOR // Re-register the osc data callback if the address was changed. if (_address != _registeredAddress) { OnDisable(); OnEnable(); } #endif }
IEnumerator InvokeRepeatedly() { // Interesting glitch, it holds previous inputs and loops them while (_repeatCount < 0) { _outputEvent.Invoke(); yield return(new WaitForSeconds(_interval)); } for (var i = 0; i < _repeatCount; i++) { _outputEvent.Invoke(); yield return(new WaitForSeconds(_interval)); } }
void OnNightTime() { currentCycle = Cycle.Night; // Debug.Log("night night dont let the mythical creatures bite"); onNightTime.Invoke(); // enemyManager.EnemiesExitStage(); }
protected override void UpdateState() { if (_currentValue >= _threshold) { _delayTimer = 0; } else if (_currentValue < _threshold && _currentState != State.Disabled) { _delayTimer += Time.deltaTime; if (_delayTimer >= _delayToOff) { if (_flip) { _onEvent.Invoke(); } else { _offEvent.Invoke(); } _currentState = State.Disabled; } } if (_flip) { _stateEvent.Invoke(_currentState == State.Disabled); } else { _stateEvent.Invoke(_currentState != State.Disabled); } }
private void Invoke(bool then) { if (then) { if (_currentState != State.BlockThenEvent) { _thenEvent.Invoke(); if (_continuousInput) { _currentState = State.BlockThenEvent; } } } else { if (_currentState != State.BlockElseEvent) { _elseEvent.Invoke(); if (_continuousInput) { _currentState = State.BlockElseEvent; } } } }
void OnTriggerStay(Collider other) { if (other.transform.tag == "Collectable") { woodTimer += Time.deltaTime; //set harvestJuice position Vector3 harvestPos = new Vector3(other.gameObject.transform.position.x, transform.position.y, other.gameObject.transform.position.z); if (harvestJuice == null) { harvestJuice = Instantiate(harvestJuicePrefab, harvestPos, Quaternion.identity, null); } harvestJuice.transform.localScale *= 1 - Time.deltaTime; if (woodTimer > 1) { onWoodHarvestAtPos.Invoke(other.transform.position); GameObject.Destroy(other.transform.gameObject); IncrementInventory(); onWoodHarvest.Invoke(); onWoodHarvestAtPos.Invoke(other.transform.position); woodTimer = 0; Destroy(harvestJuice); } } }
/// <summary> /// Called when this editor is open. /// </summary> private void OnEnable() { // Cleans the registered custom editor extensions of the removed settings. MultipleEditorsManager.Clean(); // Load settings lists, grouped by target name foreach (CustomEditorExtensionSettings settings in Target.Settings) { CustomEditorListGroup group = m_CustomEditors.Find(currentGroup => { return(currentGroup.TargetTypeName == settings.TargetTypeName); }); if (group == null) { group = new CustomEditorListGroup(settings.TargetTypeName); m_CustomEditors.Add(group); } group.List.Settings.Add(settings); } // Initialize settings lists foreach (CustomEditorListGroup group in m_CustomEditors) { group.List.Init(); } m_ExpandHelpAnimBool = new AnimBool(m_CustomEditors.Count == 0); m_ExpandHelpAnimBool.valueChanged.AddListener(() => { m_RequiresRepaintEvent.Invoke(); }); m_RequiresRepaintEvent.AddListener(Repaint); }
public void Signal() { if (enabled) { _bangEvent.Invoke(); } }
public void TriggerIfTrue(bool b) { if (b) { whenGateOpen.Invoke(); } }
void FixedUpdate() { if (isNodeActive) { _onFixedUpdateEvent.Invoke(); } }
public void Update() { button.Text.FillColor = fillColor; if (State == ButtonState.Active) { colider = button.Text.GetGlobalBounds(); if (colider.Contains(Mouse.GetPosition().X, Mouse.GetPosition().Y)) { button.Text.FillColor = Color.Red; if (!soundPlayed) { soundOnHilight.Play(); soundPlayed = true; } } else { soundPlayed = false; } if (Mouse.IsButtonPressed(Mouse.Button.Left) && colider.Contains(Mouse.GetPosition().X, Mouse.GetPosition().Y)) { onClick?.Invoke(); } } }
public void List(string category) { path = Constants.SetRoot + category; dropdownTitle.ClearOptions(); dropdownTitle.AddOptions( new DirectoryInfo(path).GetDirectories() .OrderBy(d => d.CreationTime) .Reverse() .Select(d => d.Name).ToList()); dropdownTitle.RefreshShownValue(); if (dropdownTitle.options.Count > 0) { var selected = File.ReadAllText(path + "\\Selected.txt"); var i = dropdownTitle.options.FindIndex(o => o.text == selected); dropdownTitle.value = Mathf.Max(i, 0); dropdownTitle.onValueChanged.Invoke(dropdownTitle.value); } else { onEmptyList.Invoke(); LevelManager.DestroyAll(); } }
void OnRealtime(MidiRealtime realtimeMsg) { if (realtimeMsg == MidiRealtime.Clock) { _clockEvent.Invoke(); if (_source.IsPlaying()) { _stepEvent.Invoke(1f / 96); } } else if (realtimeMsg == MidiRealtime.Start) { _startEvent.Invoke(); _playingEvent.Invoke(1); } else if (realtimeMsg == MidiRealtime.Continue) { _continueEvent.Invoke(); _playingEvent.Invoke(1); } else if (realtimeMsg == MidiRealtime.Stop) { _stopEvent.Invoke(); _playingEvent.Invoke(0); } }
void DoKnobUpdate(float inputValue) { const float threshold = 0.5f; if (_isRelative) { float relValue = (inputValue < 0.5f) ? 1 : -1; _valueEvent.Invoke(relValue / 127); } else { // Update the target value for the interpolator. _floatValue.targetValue = _responseCurve.Evaluate(inputValue); // Invoke the event in direct mode. if (!_interpolator.enabled) { _valueEvent.Invoke(_floatValue.Step()); } } // Detect an on-event and invoke the event. if (_lastInputValue < threshold && inputValue >= threshold) { _onEvent.Invoke(); } // Detect an off-event and invoke the event. if (inputValue < threshold && _lastInputValue >= threshold) { _offEvent.Invoke(); } _lastInputValue = inputValue; }
void InvokeEvent() { bool flag = _input1; switch (_modulationType) { case ModulationType.Or: flag = _input1 || _input2; break; case ModulationType.And: flag = _input1 && _input2; break; case ModulationType.Xor: flag = _input1 ^ _input2; break; } if (flag) { _onEvent.Invoke(); } else { _offEvent.Invoke(); } }
// Update is called once per frame void Update() { if (pmove.canMove) { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); if (!isSwimming) { if (h != 0 || v != 0) { StartWalking(); } else { StopWalking(); } } } if (Input.GetButtonUp("Fire1")) { mAnim.Play("attack"); onShooting.Invoke(); } }
private IEnumerator LoadResourcesCoroutine() { //assume that here is some code that loads resources yield return(new WaitForSecondsRealtime(5f)); _onLoaded?.Invoke(); }
private void UpdateTriggerFunctions() { var newShootingState = false; if (m_handsPullingTrigger.Count == 0) { newShootingState = false; } else { newShootingState = true; for (int i = 0; i < m_handsPullingTrigger.Count; i++) { // TODO-RPB: Trigger the haptics, per-hand } } if (newShootingState != m_currentShootingState) { if (newShootingState == true) { OnShootingStarted.Invoke(); } else { OnShootingEnded.Invoke(); } m_currentShootingState = newShootingState; } }
void LateUpdate() { if (isNodeActive) { _onLateUpdateEvent.Invoke(); } }
protected override void InvokeEvents() { CalculateTime(); base.InvokeEvents(); _stopwatch.Reset(); _stopwatch.Start(); _voidEvent.Invoke(); }
void OnRobotDisconnected() { if (!Active) { return; } OnDisconnect.Invoke(); }
void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports) { if (!Active) { return; } OnConnect.Invoke(); }
void OnRobotStopUpdate() { if (!Active) { return; } OnStop.Invoke(); }
public virtual void ExportInstances() { Export(true); if (OnInstancesChange != null) { OnInstancesChange.Invoke(); } }
void Start() { _value = new FloatInterpolator(_value1, _interpolator); if (_sendOnStartUp) { _state1Event.Invoke(); } }
private void OnTriggerExit2D(Collider2D other) { if (IsTriggeredPlayer(other)) { _target = null; _onPlayerLost?.Invoke(); } }
void OnRobotStartUpdate() { if (!Active) { return; } OnStart.Invoke(); }
void Start() { _value = new FloatInterpolator(0, _interpolator); if (_sendOnStartUp) { _offEvent.Invoke(); } }
public virtual void ExportClasses() { Export(false); if (OnClassesChange != null) { OnClassesChange.Invoke(); } }