Inheritance: MonoBehaviour
コード例 #1
0
        public HomeMenuModel()
        {
            _content1Property  = new WProperty(typeof(object), null);
            _content2Property  = new WProperty(typeof(object), null);
            _contentProperties = new[] { _content1Property, _content2Property };

            _contentIndexProperty = new WProperty(typeof(int), 0);
            _selectedItemProperty = new WProperty(typeof(ListItem), null);

            _menuEditModelProperty = new WProperty(typeof(MenuEditModel), null);

            _updateEvent = new DelayedEvent(UPDATE_DELAY_MS);
            _updateEvent.OnEventHandler += OnUpdate;
            _selectedItemProperty.Attach(OnSelectedItemChanged);

            GetMediaListModel().Limit = CONTENT_LIST_LIMIT;
            GetAppListModel().Limit   = CONTENT_LIST_LIMIT;

            _homeContent.Add(new Guid("80d2e2cc-baaa-4750-807b-f37714153751"), new MovieHomeContent());
            _homeContent.Add(new Guid("30f57cba-459c-4202-a587-09fff5098251"), new SeriesHomeContent());
            _homeContent.Add(new Guid("30715d73-4205-417f-80aa-e82f0834171f"), new AudioHomeContent());
            _homeContent.Add(new Guid("55556593-9fe9-436c-a3b6-a971e10c9d44"), new ImageHomeContent());
            _homeContent.Add(new Guid("A4DF2DF6-8D66-479a-9930-D7106525EB07"), new VideoHomeContent());
            _homeContent.Add(new Guid("b4a9199f-6dd4-4bda-a077-de9c081f7703"), new TVHomeContent());
            _homeContent.Add(new Guid("bb49a591-7705-408f-8177-45d633fdfad0"), new NewsHomeContent());
            _homeContent.Add(new Guid("e34fdb62-1f3e-4aa9-8a61-d143e0af77b5"), new WeatherHomeContent());
            _homeContent.Add(new Guid("873eb147-c998-4632-8f86-d5e24062be2e"), new LauncherHomeContent());
            _homeContent.Add(new Guid("c33e39cc-910e-41c8-bffd-9eccd340b569"), new OnlineVideosHomeContent());
            _homeContent.Add(new Guid("2ded75c0-5eae-4e69-9913-6b50a9ab2956"), new WebradioHomeContent());

            // Home content for displaying a list of all other plugins
            _homeContent.Add(OtherPluginsAction.ACTION_ID, new OtherPluginsHomeContent(_otherMenuItems));

            SubscribeToMessages();
        }
コード例 #2
0
ファイル: MainPage.xaml.cs プロジェクト: PrithviVenu/ZTasks
        private void ListBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            ListBoxItem item = ListBox.SelectedItem as ListBoxItem;

            Home.Background = new SolidColorBrush(Colors.Transparent);
            MyFrame.BackStack.Clear();
            MyFrame.Navigate(typeof(HomePage), this, new SuppressNavigationTransitionInfo());
            if (Home.IsSelected)
            {
                HomeEvent?.Invoke();
            }

            else if (Today.IsSelected)
            {
                TodayEvent?.Invoke();
            }

            else if (Upcoming.IsSelected)
            {
                UpcomingEvent?.Invoke();
            }
            else if (Delayed.IsSelected)
            {
                DelayedEvent?.Invoke();
            }
            else if (AssignedToOthers.IsSelected)
            {
                AssignedToOthersEvent?.Invoke();
            }
        }
コード例 #3
0
ファイル: SendRandomEvent.cs プロジェクト: ahvonenj/TheForest
 public override void OnUpdate()
 {
     if (DelayedEvent.WasSent(this.delayedEvent))
     {
         base.Finish();
     }
 }
コード例 #4
0
ファイル: EventBus.cs プロジェクト: ylyking/unity-object-pool
	private void OnEvtComplete(DelayedEvent evt)
	{
		evt.Triggered -= OnEvtComplete;
		activeEvents.Remove(evt);
		eventPool.ReleaseItem(evt);
		Debug.Log("Delayed event started at " + evt.startTime + " completed at "+ evt.endTime);
	}
コード例 #5
0
        private void DoBlendAnimation(GameObject go)
        {
            if (go == null)
            {
                return;
            }
            Animation animation = go.GetComponent <Animation>();

            if (animation == null)
            {
                LogWarning("Missing Animation component on GameObject: " + go.name);
                Finish();
                return;
            }
            AnimationState animationState = animation[animName.Value];

            if (animationState == null)
            {
                LogWarning("Missing animation: " + animName.Value);
                Finish();
                return;
            }
            float value = time.Value;

            animation.Blend(animName.Value, targetWeight.Value, value);
            if (finishEvent != null)
            {
                delayedFinishEvent = base.Fsm.DelayedEvent(finishEvent, animationState.length);
            }
            else
            {
                Finish();
            }
        }
コード例 #6
0
        public override void OnEnter()
        {
            if (reset.Value)
            {
                eventIndex  = 0;
                reset.Value = false;
            }

            var eventCount = State.Transitions.Length;

            if (eventCount > 0)
            {
                var fsmEvent = State.Transitions[eventIndex].FsmEvent;

                if (delay.Value < 0.001f)
                {
                    Fsm.Event(fsmEvent);
                    Finish();
                }
                else
                {
                    delayedEvent = Fsm.DelayedEvent(fsmEvent, delay.Value);
                }

                eventIndex++;
                if (eventIndex == eventCount)
                {
                    eventIndex = 0;
                }
            }
        }
コード例 #7
0
ファイル: SendEventToFsm.cs プロジェクト: ahvonenj/TheForest
        public override void OnEnter()
        {
            this.go = base.Fsm.GetOwnerDefaultTarget(this.gameObject);
            if (this.go == null)
            {
                base.Finish();
                return;
            }
            PlayMakerFSM gameObjectFsm = ActionHelpers.GetGameObjectFsm(this.go, this.fsmName.Value);

            if (gameObjectFsm == null)
            {
                if (this.requireReceiver)
                {
                    this.LogError("GameObject doesn't have FsmComponent: " + this.go.name + " " + this.fsmName.Value);
                }
                return;
            }
            if ((double)this.delay.Value < 0.001)
            {
                gameObjectFsm.Fsm.Event(this.sendEvent.Value);
                base.Finish();
            }
            else
            {
                this.delayedEvent = gameObjectFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(this.sendEvent.Value), this.delay.Value);
            }
        }
コード例 #8
0
 private void OnEvtComplete(DelayedEvent evt)
 {
     evt.Triggered -= OnEvtComplete;
     activeEvents.Remove(evt);
     eventPool.ReleaseItem(evt);
     Debug.Log("Delayed event started at " + evt.startTime + " completed at " + evt.endTime);
 }
コード例 #9
0
        private void DoBlendAnimation(GameObject go)
        {
            if (go == null)
            {
                return;
            }
            Animation component = go.GetComponent <Animation>();

            if (component == null)
            {
                this.LogWarning("Missing Animation component on GameObject: " + go.name);
                base.Finish();
                return;
            }
            AnimationState animationState = component[this.animName.Value];

            if (animationState == null)
            {
                this.LogWarning("Missing animation: " + this.animName.Value);
                base.Finish();
                return;
            }
            float value = this.time.Value;

            component.Blend(this.animName.Value, this.targetWeight.Value, value);
            if (this.finishEvent != null)
            {
                this.delayedFinishEvent = base.Fsm.DelayedEvent(this.finishEvent, animationState.length);
            }
            else
            {
                base.Finish();
            }
        }
コード例 #10
0
 protected AbstractSearchScreenData(string screen, string menuItemLabel, PlayableItemCreatorDelegate playableItemCreator, bool applyUserFilter = true) :
     base(screen, menuItemLabel, null, playableItemCreator, false)
 {
     _applyUserFilter              = applyUserFilter;
     _delayedEvent                 = new DelayedEvent(Consts.TS_SEARCH_TEXT_TYPE.TotalMilliseconds);
     _delayedEvent.OnEventHandler += OnSearchTimerElapsed;
 }
コード例 #11
0
		public override void OnEnter()
		{
			var eventCount = State.Transitions.Length;

			if (eventCount > 0)
			{
				var fsmEvent = State.Transitions[eventIndex].FsmEvent;
				
				if (delay.Value < 0.001f)
				{
					Fsm.Event(fsmEvent);
					Finish();
				}
				else
				{
					delayedEvent = Fsm.DelayedEvent(fsmEvent, delay.Value);
				}
				
				eventIndex++;
				if (eventIndex == eventCount)
				{
					eventIndex = 0;
				}
			}
		}
コード例 #12
0
        public static void AddListener(Action action, string key)
        {
            string       path         = $"{action.Method.DeclaringType?.FullName}.{action.Method.Name}";
            DelayedEvent delayedEvent = new DelayedEvent()
            {
                path = path,
                key  = key
            };

            if (instance.delayedEvents.FindIndex(e => e.path == path) != -1)
            {
                Debug.LogError(path + " already be registered.");
            }
            else if (!action.Method.IsStatic)
            {
                Debug.LogError(path + " is not static method.");
            }
            else if (action.Method.Name.StartsWith("<"))
            {
                Debug.LogError(path + " is anonymous method.");
            }
            else
            {
                instance.delayedEvents.Add(delayedEvent);
            }
        }
コード例 #13
0
    public void GameUpdate()
    {
        //Loop through the array backwards to avoid dysnc
        for (int i = queue.Count - 1; i >= 0; i--)
        {
            //Get the event we are checking
            DelayedEvent call = queue[i];

            //Add the passed time to this event
            call.currentTime += Time.deltaTime;
            //Debug.Log("Event Time: "+call.currentTime + "/" + call.maxTime);

            //Check if this events passed time is greater than its call time
            if (call.currentTime > call.maxTime)
            {
                //Debug.Log("Firing Event " + call.currentTime + "/"+call.maxTime);
                //Invoke each action in this event.
                foreach (UnityAction action in call.actions)
                {
                    action.Invoke();
                }

                //Remove it from the list
                queue.RemoveAt(i);
            }
        }
    }
コード例 #14
0
        void DoBlendAnimation(GameObject go)
        {
            if (go == null) return;

            if (go.animation == null)
            {
                LogWarning("Missing Animation component on GameObject: " + go.name);
                return;
            }

            AnimationState anim = go.animation[animName.Value];

            if (anim == null)
            {
                LogWarning("Missing animation: " + animName.Value);
                return;
            }

            float timeValue = time.Value;
            go.animation.Blend(animName.Value, targetWeight.Value, timeValue);

            // TODO: doesn't work well with scaled time
            if (finishEvent != null)
                delayedFinishEvent = new DelayedEvent(Fsm, finishEvent, anim.length);
            else
                Finish();
        }
コード例 #15
0
        public override void OnEnter()
        {
            go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                Finish();
                return;
            }

            var sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (sendToFsm == null)
            {
                if (requireReceiver)
                {
                    LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }

                return;
            }

            if (delay.Value < 0.001)
            {
                sendToFsm.Fsm.Event(sendEvent.Value);
                Finish();
            }
            else
            {
                delayedEvent = sendToFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value);
            }
        }
コード例 #16
0
ファイル: BloxGlobal.cs プロジェクト: ljn398431/MyMakerTest
 protected void Update()
 {
     if (this.delayedEvents.Count != 0)
     {
         this.delayedEventIdx = this.delayedEvents.Count - 1;
         while (this.delayedEventIdx >= 0)
         {
             if ((UnityEngine.Object) this.delayedEvents[this.delayedEventIdx].container == (UnityEngine.Object)null || (UnityEngine.Object) this.delayedEvents[this.delayedEventIdx].container.gameObject == (UnityEngine.Object)null)
             {
                 this.delayedEvents.RemoveAt(this.delayedEventIdx);
             }
             else
             {
                 this.delayedEvents[this.delayedEventIdx].timer -= Time.deltaTime;
                 if (this.delayedEvents[this.delayedEventIdx].timer <= 0.0)
                 {
                     DelayedEvent delayedEvent = this.delayedEvents[this.delayedEventIdx];
                     delayedEvent.container.TriggerEvent(delayedEvent.eventName, delayedEvent.args);
                     this.delayedEvents.RemoveAt(this.delayedEventIdx);
                 }
             }
             this.delayedEventIdx--;
         }
     }
 }
コード例 #17
0
        public override void OnEnter()
        {
            go = Fsm.GetOwnerDefaultTarget(gameObject);

            if (go == null)
            {
                Finish();
                return;
            }

            var sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (sendToFsm == null)
            {
                if (requireReceiver)
                {
                    LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }

                return;
            }

            if (delay.Value < 0.001)
            {
                sendToFsm.Fsm.Event(sendEvent.Value);
                Finish();
            }
            else
            {
                delayedEvent = sendToFsm.Fsm.DelayedEvent(FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value);
            }
        }
コード例 #18
0
 public override void OnUpdate()
 {
     if (DelayedEvent.WasSent(delayedEvent))
     {
         Finish();
     }
 }
コード例 #19
0
ファイル: BlendAnimation.cs プロジェクト: GameDiffs/TheForest
 private void DoBlendAnimation(GameObject go)
 {
     if (go == null)
     {
         return;
     }
     Animation component = go.GetComponent<Animation>();
     if (component == null)
     {
         this.LogWarning("Missing Animation component on GameObject: " + go.name);
         base.Finish();
         return;
     }
     AnimationState animationState = component[this.animName.Value];
     if (animationState == null)
     {
         this.LogWarning("Missing animation: " + this.animName.Value);
         base.Finish();
         return;
     }
     float value = this.time.Value;
     component.Blend(this.animName.Value, this.targetWeight.Value, value);
     if (this.finishEvent != null)
     {
         this.delayedFinishEvent = base.Fsm.DelayedEvent(this.finishEvent, animationState.length);
     }
     else
     {
         base.Finish();
     }
 }
コード例 #20
0
 /// <summary>
 /// Creates and initializes a new internal <see cref="_DeviceVolumeMonitor"/> instance.
 /// </summary>
 /// <param name="monitor">The DeviceVolumeMonitor instance that ownes this object.</param>
 public _DeviceVolumeMonitor(DeviceVolumeMonitor monitor)
 {
     _monitor          = monitor;
     _knownDrives      = GetCurrentDriveLetters();
     _checkDrivesTimer = new DelayedEvent(2000);
     _checkDrivesTimer.OnEventHandler += CheckDrives;
 }
コード例 #21
0
ファイル: RandomEvent.cs プロジェクト: CodeStrumpet/Elemental
        public override void OnEnter()
        {
            if (State.Transitions.Length == 0) return;

            delayedEvent = new DelayedEvent(Fsm, GetRandomEvent(), delay.Value);
            delayedEvent.Update();
        }
コード例 #22
0
        public override void OnEnter()
        {
            go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

            if (go == null)
            {
                Finish();
                return;
            }

            PlayMakerFSM sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (sendToFsm == null)
            {
                if (requireReceiver)
                {
                    LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }

                return;
            }

            delayedEvent = new DelayedEvent(sendToFsm, sendEvent.Value, delay.Value);
            delayedEvent.Update();
        }
コード例 #23
0
ファイル: SendEventToFsm.cs プロジェクト: Sprayah/Elemental
        public override void OnEnter()
        {
            go = gameObject.OwnerOption == OwnerDefaultOption.UseOwner ? Owner : gameObject.GameObject.Value;

            if (go == null)
            {
                Finish();
                return;
            }

            PlayMakerFSM sendToFsm = ActionHelpers.GetGameObjectFsm(go, fsmName.Value);

            if (sendToFsm == null)
            {
                if (requireReceiver)
                {
                    LogError("GameObject doesn't have FsmComponent: " + go.name + " " + fsmName.Value);
                }

                return;
            }

            delayedEvent = new DelayedEvent(sendToFsm, sendEvent.Value, delay.Value);
            delayedEvent.Update();
        }
コード例 #24
0
ファイル: Section.cs プロジェクト: laurilubi/FileSysWatcher
        private void EventHandler(object sender, FileSystemEventArgs e)
        {
            try
            {
                var delayStr = eventDelay.TotalMilliseconds == 0
                    ? "no delay"
                    : string.Format("will be delayed for {0}", eventDelay);
                if (e.ChangeType == WatcherChangeTypes.Created)
                {
                    Util.WriteLog(string.Format("Created {0}, {1}", e.FullPath, delayStr));
                }
                else if (e.ChangeType == WatcherChangeTypes.Changed)
                {
                    Util.WriteLog(string.Format("Changed {0}, {1}", e.FullPath, delayStr));
                }
                else if (e.ChangeType == WatcherChangeTypes.Deleted)
                {
                    Util.WriteLog(string.Format("Deleted {0}, {1}", e.FullPath, delayStr));
                }
                else if (e.ChangeType == WatcherChangeTypes.Renamed)
                {
                    Util.WriteLog(string.Format("Renamed {0} to {1}, {2}", ((RenamedEventArgs)e).OldFullPath, e.FullPath, delayStr));
                }

                if (filenameMatchRegexObj != null && !filenameMatchRegexObj.IsMatch(e.FullPath))
                {
                    Util.WriteLog(string.Format("File {0} does not match regex {1}. Skipping the file.", e.FullPath, filenameMatchRegex));
                    return;
                }

                // make sure that timer object gets inserted into DelayedEvent
                var msDelay = eventDelay.TotalMilliseconds < 10
                    ? 10
                    : (int)eventDelay.TotalMilliseconds;

                DelayedEvent delayedEvent;
                if (DelayedEvents.ContainsKey(e.FullPath))
                {
                    Util.WriteLog(string.Format("Delaying existing event for {0}", e.FullPath));
                    delayedEvent = DelayedEvents[e.FullPath];
                    delayedEvent.FileSystemEvent = e;
                    delayedEvent.Timer.Change(msDelay, Timeout.Infinite);
                    return;
                }

                // new event
                delayedEvent = new DelayedEvent();
                DelayedEvents.Add(e.FullPath, delayedEvent);
                delayedEvent.FileSystemEvent = e;
                var timer = new Timer(EventHandlerTimerCallback, delayedEvent, msDelay, Timeout.Infinite);
                delayedEvent.Timer = timer;
            }
            catch (Exception ex)
            {
                Util.LogError(ex);
            }
        }
コード例 #25
0
		public override void OnUpdate()
		{
			DoSetFsmVariable();

			if(!everyFrame)
			{
				if(DelayedEvent.WasSent(delayedEvent)) Finish();
			} else
				Fsm.Event(eventTarget, sendEvent);
		}
コード例 #26
0
        public override void OnEnter()
        {
            if (State.Transitions.Length == 0)
            {
                return;
            }

            delayedEvent = new DelayedEvent(Fsm, GetRandomEvent(), delay.Value);
            delayedEvent.Update();
        }
コード例 #27
0
		public override void OnEnter()
		{
			DoSetFsmVariable();

			if(delay.Value < 0.001f)
			{
				Fsm.Event(eventTarget, sendEvent);
				if(!everyFrame) Finish();
			} else
				delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value);
		}
コード例 #28
0
ファイル: SendEvent.cs プロジェクト: GameDiffs/TheForest
 public override void OnEnter()
 {
     if (this.delay.Value < 0.001f)
     {
         base.Fsm.Event(this.eventTarget, this.sendEvent);
         base.Finish();
     }
     else
     {
         this.delayedEvent = base.Fsm.DelayedEvent(this.eventTarget, this.sendEvent, this.delay.Value);
     }
 }
コード例 #29
0
ファイル: Section.cs プロジェクト: laurilubi/FileSysWatcher
        public bool PreCondition(DelayedEvent delayedEvent)
        {
            var commandResult = ModuleTools.ExecuteCommand(preConditionCommand, delayedEvent, this, settings, ModuleBase.PREFIX_PRECONDITION);

            if (commandResult.Error != null)
            {
                Util.LogError(commandResult.Error);
                return(false);
            }
            Util.WriteLog(string.Format("ExitCode {0}, expected {1}", commandResult.ExitCode, preConditionExpectedExitCode));
            return(commandResult.ExitCode == preConditionExpectedExitCode);
        }
コード例 #30
0
        protected void Init()
        {
            _currentContentIndexProperty = new WProperty(typeof(int), 0);
            _isContentFocusedProperty    = new WProperty(typeof(bool), false);
            _focusedContentIndexProperty = new WProperty(typeof(int), -1);
            _content0ActionIdProperty    = new WProperty(typeof(string), null);
            _content1ActionIdProperty    = new WProperty(typeof(string), null);
            _updateEvent = new DelayedEvent(UPDATE_DELAY_MS);
            _updateEvent.OnEventHandler += OnUpdate;

            SubscribeToMessages();
        }
コード例 #31
0
 public override void OnEnter()
 {
     if (delay.Value == 0f)
     {
         Fsm.Event(sendEvent);
         Finish();
     }
     else
     {
         delayedEvent = new DelayedEvent(Fsm, sendEvent, delay.Value);
     }
 }
コード例 #32
0
 public override void OnEnter()
 {
     if (this.delay.Value < 0.001f)
     {
         base.Fsm.Event(this.eventTarget, this.sendEvent.Value);
         base.Finish();
     }
     else
     {
         this.delayedEvent = base.Fsm.DelayedEvent(this.eventTarget, FsmEvent.GetFsmEvent(this.sendEvent.Value), this.delay.Value);
     }
 }
コード例 #33
0
ファイル: SendEvent.cs プロジェクト: CodeStrumpet/Elemental
 public override void OnEnter()
 {
     if (delay.Value == 0f)
     {
         Fsm.Event(eventTarget, sendEvent);
         Finish();
     }
     else
     {
         delayedEvent = new DelayedEvent(Fsm, eventTarget, sendEvent, delay.Value);
     }
 }
コード例 #34
0
 public override void OnEnter()
 {
     if (delay.Value < 0.001f)
     {
         Fsm.Event(eventTarget, sendEvent);
         Finish();
     }
     else
     {
         delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value);
     }
 }
コード例 #35
0
        private void ReSetZapTimer()
        {
            ShowZapOSD();
            SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>();

            if (_zapTimer == null)
            {
                _zapTimer = new DelayedEvent(settings.ZapTimeout * 1000);
                _zapTimer.OnEventHandler += ZapTimerElapsed;
            }
            _zapTimer.EnqueueEvent(this, EventArgs.Empty);
        }
コード例 #36
0
ファイル: SendEvent.cs プロジェクト: OmegaDEVAU/Simulator
		public override void OnEnter()
		{
			if (delay.Value < 0.001f)
			{
				Fsm.Event(eventTarget, sendEvent);
				Finish();
			}
			else
			{
				delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value);
			}
		}
コード例 #37
0
        private void ReSetSkipTimer()
        {
            ShowSkipOSD();
            MediaModelSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <MediaModelSettings>();

            if (_skipStepTimer == null)
            {
                _skipStepTimer = new DelayedEvent(settings.SkipStepTimeout * 1000);
                _skipStepTimer.OnEventHandler += SkipStepTimerElapsed;
            }
            _skipStepTimer.EnqueueEvent(this, EventArgs.Empty);
        }
コード例 #38
0
ファイル: SendEvent2.cs プロジェクト: danhigham/FESUnityDemo
 public override void OnEnter()
 {
     if (delay.Value == 0f)
     {
         Debug.Log("sendEvent.Value " + sendEvent.Value );
         Fsm.Event(eventTarget, sendEvent.Value);
         Finish();
     }
     else
     {
         delayedEvent = new DelayedEvent(Fsm, eventTarget, sendEvent.Value, delay.Value);
     }
 }
コード例 #39
0
ファイル: SendEvent.cs プロジェクト: apdev01/ReachingM
 public override void OnUpdate()
 {
     if (!everyFrame)
     {
         if (DelayedEvent.WasSent(delayedEvent))
         {
             Finish();
         }
     }
     else
     {
         Fsm.Event(eventTarget, sendEvent);
     }
 }
コード例 #40
0
        /// <summary>
        /// Sets or resets the zap timer. When the timer elapses, the new selected channel is tuned.
        /// </summary>
        private void ReSetSkipTimer()
        {
            ShowOSD();
            UpdateRunningChannelPrograms(ChannelContext.Instance.Channels[_zapChannelIndex]);

            if (_zapTimer == null)
            {
                SlimTvClientSettings settings = ServiceRegistration.Get <ISettingsManager>().Load <SlimTvClientSettings>();
                _zapTimer = new DelayedEvent(settings.ZapTimeout * 1000);
                _zapTimer.OnEventHandler += ZapTimerElapsed;
            }
            // In case of new user action, reset the timer.
            _zapTimer.EnqueueEvent(this, EventArgs.Empty);
        }
コード例 #41
0
 public override void OnEnter()
 {
     if (delay.Value < 0.001f)
     {
         base.Fsm.Event(eventTarget, sendEvent);
         if (!everyFrame)
         {
             Finish();
         }
     }
     else
     {
         delayedEvent = base.Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value);
     }
 }
コード例 #42
0
		public override void OnEnter()
		{
			if (delay.Value < 0.001f)
			{
				Fsm.Event(eventTarget, sendEvent.Value);
                if (!everyFrame)
                {
                    Finish();
                }
			}
			else
			{
				delayedEvent = Fsm.DelayedEvent(eventTarget, FsmEvent.GetFsmEvent(sendEvent.Value), delay.Value);
			}
		}
コード例 #43
0
		public override void OnEnter()
		{
			int eventCount = State.Transitions.Length;

			if (eventCount > 0)
			{
				string eventName = State.Transitions[eventIndex].EventName;
				delayedEvent = new DelayedEvent(Fsm, eventName, delay.Value);
				delayedEvent.Update();

				eventIndex++;
				if (eventIndex == eventCount)
					eventIndex = 0;
			}
		}
コード例 #44
0
        public void DoEvent()
        {
            if (!everyFrame && DelayedEvent.WasSent(delayedEvent))
            {
                Finish();
            }

            if (delay.Value < 0.001f)
            {
                Fsm.Event(eventTarget, sendEvent);
            }

            else
            {
                delayedEvent = Fsm.DelayedEvent(eventTarget, sendEvent, delay.Value);
            }
        }
コード例 #45
0
		public override void OnEnter()
		{
			if (State.Transitions.Length == 0)
			{
				return;
			}
			
			if (delay.Value < 0.001f)
			{
				Fsm.Event(GetRandomEvent());
				Finish();
			}
			else
			{
				delayedEvent = Fsm.DelayedEvent(GetRandomEvent(), delay.Value);
			}
		}
コード例 #46
0
        public override void OnEnter()
        {
            if (events.Length > 0)
            {
                int randomIndex = ActionHelpers.GetRandomWeightedIndex(weights);

                if (randomIndex != -1)
                {
                    delayedEvent = new DelayedEvent(Fsm, events[randomIndex], delay.Value);
                    delayedEvent.Update();

                    if (delayedEvent.Finished)
                        Finish();

                    return;
                }
            }

            Finish();
        }
コード例 #47
0
ファイル: RandomEvent.cs プロジェクト: GameDiffs/TheForest
 public override void OnEnter()
 {
     if (base.State.Transitions.Length == 0)
     {
         return;
     }
     if (this.lastEventIndex == -1)
     {
         this.lastEventIndex = UnityEngine.Random.Range(0, base.State.Transitions.Length);
     }
     if (this.delay.Value < 0.001f)
     {
         base.Fsm.Event(this.GetRandomEvent());
         base.Finish();
     }
     else
     {
         this.delayedEvent = base.Fsm.DelayedEvent(this.GetRandomEvent(), this.delay.Value);
     }
 }
コード例 #48
0
		public override void OnEnter()
		{
			if (events.Length > 0)
			{
				int randomIndex = ActionHelpers.GetRandomWeightedIndex(weights);
			
				if (randomIndex != -1)
				{
					if (delay.Value < 0.001f)
					{
						Fsm.Event(events[randomIndex]);
						Finish();
					}
					else
					{
						delayedEvent = Fsm.DelayedEvent(events[randomIndex], delay.Value);
					}
					
					return;
				}
			}						
			
			Finish();
		}
コード例 #49
0
        void DoBlendAnimation(GameObject go)
        {
            if (go == null)
            {
                return;
            }

            if (go.animation == null)
            {
                LogWarning("Missing Animation component on GameObject: " + go.name);
                Finish();
                return;
            }

            var anim = go.animation[animName.Value];

            if (anim == null)
            {
                LogWarning("Missing animation: " + animName.Value);
                Finish();
                return;
            }

            var timeValue = time.Value;
            go.animation.Blend(animName.Value, targetWeight.Value, timeValue);

            // TODO: doesn't work well with scaled time
            if (finishEvent != null)
            {
                delayedFinishEvent = Fsm.DelayedEvent(finishEvent, anim.length);
            }
            else
            {
                Finish();
            }
        }