예제 #1
0
        void Start()
        {
            _onStartEvent.Invoke();
            _onEnabledEvent.Invoke();

            _hasStarted = true;
        }
예제 #2
0
        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
        }
예제 #3
0
파일: Repeat.cs 프로젝트: logicRCA/Klak
        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));
            }
        }
예제 #4
0
    void OnNightTime()
    {
        currentCycle = Cycle.Night;
        //        Debug.Log("night night dont let the mythical creatures bite");
        onNightTime.Invoke();
//        enemyManager.EnemiesExitStage();
    }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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;
                    }
                }
            }
        }
예제 #7
0
    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);
            }
        }
    }
예제 #8
0
        /// <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);
        }
예제 #9
0
 public void Signal()
 {
     if (enabled)
     {
         _bangEvent.Invoke();
     }
 }
예제 #10
0
 public void TriggerIfTrue(bool b)
 {
     if (b)
     {
         whenGateOpen.Invoke();
     }
 }
예제 #11
0
 void FixedUpdate()
 {
     if (isNodeActive)
     {
         _onFixedUpdateEvent.Invoke();
     }
 }
예제 #12
0
        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();
                }
            }
        }
예제 #13
0
        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();
            }
        }
예제 #14
0
        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);
            }
        }
예제 #15
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;
        }
예제 #16
0
        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();
            }
        }
예제 #17
0
    // 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();
        }
    }
예제 #18
0
        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;
            }
        }
예제 #20
0
 void LateUpdate()
 {
     if (isNodeActive)
     {
         _onLateUpdateEvent.Invoke();
     }
 }
예제 #21
0
 protected override void InvokeEvents()
 {
     CalculateTime();
     base.InvokeEvents();
     _stopwatch.Reset();
     _stopwatch.Start();
     _voidEvent.Invoke();
 }
예제 #22
0
 void OnRobotDisconnected()
 {
     if (!Active)
     {
         return;
     }
     OnDisconnect.Invoke();
 }
예제 #23
0
 void OnRobotConnected(RobotInfo ifo, RobotConnector.TargetPorts ports)
 {
     if (!Active)
     {
         return;
     }
     OnConnect.Invoke();
 }
예제 #24
0
 void OnRobotStopUpdate()
 {
     if (!Active)
     {
         return;
     }
     OnStop.Invoke();
 }
예제 #25
0
 public virtual void ExportInstances()
 {
     Export(true);
     if (OnInstancesChange != null)
     {
         OnInstancesChange.Invoke();
     }
 }
예제 #26
0
파일: ToggleFour.cs 프로젝트: mrayy/Klak
 void Start()
 {
     _value = new FloatInterpolator(_value1, _interpolator);
     if (_sendOnStartUp)
     {
         _state1Event.Invoke();
     }
 }
예제 #27
0
 private void OnTriggerExit2D(Collider2D other)
 {
     if (IsTriggeredPlayer(other))
     {
         _target = null;
         _onPlayerLost?.Invoke();
     }
 }
예제 #28
0
 void OnRobotStartUpdate()
 {
     if (!Active)
     {
         return;
     }
     OnStart.Invoke();
 }
예제 #29
0
 void Start()
 {
     _value = new FloatInterpolator(0, _interpolator);
     if (_sendOnStartUp)
     {
         _offEvent.Invoke();
     }
 }
예제 #30
0
 public virtual void ExportClasses()
 {
     Export(false);
     if (OnClassesChange != null)
     {
         OnClassesChange.Invoke();
     }
 }