// Add the other functions here public override void Trigger(TriggerAction action) { // Support the door opening and closing if (action == TriggerAction.Toggle) { if (_targetPosition == _endPosition) { _targetPosition = _startPosition; } else { _targetPosition = _endPosition; } } else { if (action == TriggerAction.Deactivate) { _targetPosition = _startPosition; } else { _targetPosition = _endPosition; } } // Use a coroutine so we only update when the door is moving if (_update != null) { StopCoroutine(_update); _update = null; } _update = StartCoroutine(MoveToTarget()); }
IEnumerator Start() { yield return(new WaitUntil(() => gameObject.IsInActiveScene())); yield return(new WaitWhile(() => LevelManager.instance.IsCurrentlyLoadingScenes)); yield return(new WaitUntil(() => portal != null)); MagicTrigger trigger = GetComponent <MagicTrigger>(); TriggerAction action = trigger.actionsToTrigger.Find(a => a.action == triggerType); if (action.objectsToDisable == null) { if (portal != null) { action.objectsToDisable = new[] { portal.gameObject }; } } else if (!action.objectsToDisable.Contains(portal.gameObject)) { List <GameObject> objects = action.objectsToDisable.ToList(); objects.Add(portal.gameObject); action.objectsToDisable = objects.ToArray(); } }
private static void TriggerAddAction(VTrigger trigger, TriggerAction ta) { if (trigger != null && ta != null && !trigger.func_actions.Contains(ta)) { trigger.func_actions.Add(ta); } }
public override void Run(TriggerAction trigger) { if (trigger == null) { base.Run(trigger); } }
public void DoAction(PlatformerMotor2D motor, TriggerAction action, bool exitFreeMode) { switch(action) { case TriggerAction.EnableRestrictedAreaIfFreemode: if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.EnableRestrictedArea(); } break; case TriggerAction.EnableRestrictedArea: motor.EnableRestrictedArea(); break; case TriggerAction.DisableRestrictedAreaIfFreemode: if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.DisableRestrictedArea(); } break; case TriggerAction.DisableRestrictedArea: motor.DisableRestrictedArea(); break; } if (exitFreeMode) { if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.FreedomStateExit(); } } }
/// <summary> /// Selects the proper action. /// </summary> /// <returns> /// The proper action. /// </returns> /// <param name='option'> /// Option. /// </param> protected TriggerHandler SelectProperAction(string option){ TriggerAction T_Action = new TriggerAction(); if(option == "fly"){ return T_Action.FlyAway; } return null; }
public override void start() { //效果的东西 后端不用抄写。 if (this._data.ContainsKey("preEffect")) { this._player.dispatchEventWith(EventConstant.START, this); } if (this._data.ContainsKey("preTime")) { this.preTimeAction = new TimeAction(this._map).init((int)(this._data["preTime"])); this.addAction(this.preTimeAction); } this.addAction(new HandlerAction(this._map).init(this.onAliveHandler, 1)); //—————————————————————live——————————————————————— if (this._data.ContainsKey("time")) { int totalTime = (int)this._data["time"]; if (this._data.ContainsKey("live")) { Dictionary <string, object> live = (Dictionary <string, object>) this._data["live"]; //buff if (live.ContainsKey("buff")) { this.addAction(new HandlerAction(this._map).init(this.createBuff, 2)); } //triggers if (live.ContainsKey("triggers")) { //给当前并行的触发器 加到装备里面。 object[] triggers = (object[])live["triggers"]; for (int i = 0, len = triggers.Length; i < len; i++) { Dictionary <string, object> triggerData = (Dictionary <string, object>)triggers[i]; TriggerAction action = null; int interval = (int)(triggerData["time"]); if (triggerData.ContainsKey("skill")) { action = new TriggerAction(this._map).initTrigger(interval, totalTime, triggerData, this._player, this.lockTarget); action.breakAction = this; action.breakGroup = Utils.equal(triggerData, "break", 1); } else if (triggerData.ContainsKey("beam")) { action = new BeamAction(this._map).initTrigger(interval, totalTime, triggerData, this._player, this.lockTarget); action.breakAction = this; } this._triggers.addAction(action); } } } this.addAction(new TimeAction(this._map).init(totalTime)); } base.start(); }
private IEnumerable <EmbedFieldObject> StandardFields(TriggerAction action) { yield return(new EmbedFieldObject { IsInline = true, Name = "Card:", Value = $"[{action.Data.Card.Name}](https://trello.com/c/{action.Data.Card.ShortLink})" }); yield return(new EmbedFieldObject { IsInline = true, Name = "Member:", Value = $"{action.MemberCreator.FullName} ({action.MemberCreator.UserName})", }); var discordUserId = _trelloUserService.GetDiscordUserId(action.MemberCreator.UserName); if (!string.IsNullOrEmpty(discordUserId)) { yield return(new EmbedFieldObject { IsInline = false, Name = "Discord User:", Value = discordUserId }); } }
public override void Trigger(TriggerAction action) { if (!_triggered) { StartCoroutine(TriggerDelayed()); } }
public void DoAction(PlatformerMotor2D motor, TriggerAction action, bool exitFreeMode) { switch (action) { case TriggerAction.EnableRestrictedAreaIfFreemode: if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.EnableRestrictedArea(); } break; case TriggerAction.EnableRestrictedArea: motor.EnableRestrictedArea(); break; case TriggerAction.DisableRestrictedAreaIfFreemode: if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.DisableRestrictedArea(); } break; case TriggerAction.DisableRestrictedArea: motor.DisableRestrictedArea(); break; } if (exitFreeMode) { if (motor.motorState == PlatformerMotor2D.MotorState.FreedomState) { motor.FreedomStateExit(); } } }
public void ExecuteAction() { if (_firstTriggered != null && (DateTime.UtcNow - TriggerPeriod) > _firstTriggered) { // make sure no recent action was taken on this foreach (var actionItem in ActionHistory) { if (actionItem.TriggerItem.Application.Properties.ApplicationName == _triggeringItem.Application.Properties.ApplicationName && actionItem.TriggerItem.Service.Properties.ServiceName == _triggeringItem.Service.Properties.ServiceName && (DateTime.UtcNow - ActionGracePeriod) < actionItem.TimeTriggeredUtc) { // we should do any new action yet - we have a grace period return; } } TriggerAction.Execute(_triggeringItem); WatchdogEventSource.Current.ActionFired(TriggerAction.GetType().FullName, this.ToString(_triggeringItem), _triggeringItem.ToString()); ActionHistory.Add(new RuleActionItem() { TimeTriggeredUtc = DateTime.UtcNow, TriggerItem = _triggeringItem, TriggerAction = TriggerAction }); } }
public static TriggerEvent Convert(TriggerAction action) { return(new TriggerEvent { SensorID = ByteString.CopyFrom(action.SensorID.ToByteArray()), Type = ConvertChannel(action.Channel) }); }
public virtual void ExecuteAction(TriggerAction trigger, GameObject invoker) { if (!IsLocked()) { Debug.Log("Executed: " + gameObject.name + " from " + trigger.name + " by " + (invoker != null ? invoker.name : "NONE")); } else { } }
public override void Trigger(TriggerAction action) { if (action == TriggerAction.Toggle) { if (_targetPosition == _endPosition) { _targetPosition = _startPosition; } else { _targetPosition = _endPosition; } } else { if (action == TriggerAction.Deactivate) { _targetPosition = _startPosition; } else { _targetPosition = _endPosition; } } if (_update != null) { StopCoroutine(_update); _update = null; } _update = StartCoroutine(MoveToTarget()); }
internal SqlTriggerContext (TriggerAction triggerAction, bool[] columnsUpdated, SqlXml eventData) { this.triggerAction = triggerAction; this.columnsUpdated = columnsUpdated; this.eventData = eventData; }
internal SqlTriggerContext(TriggerAction triggerAction, bool[] columnsUpdated, SqlXml eventData) { this.triggerAction = triggerAction; this.columnsUpdated = columnsUpdated; this.eventData = eventData; }
public SwitchPropertiesModel(Configuration config, TriggerAction saveTrigger, List <string> logos) { _trigger = saveTrigger; TriggerConfigCommand = new RelayCommand(OnTriggerConfig); FadeDuration = config.CrossFadeDuration.ToString("F2"); if (CheckProperty(config.Cam1Source)) { Cam1Source = config.Cam1Source; } if (CheckProperty(config.Cam2Source)) { Cam2Source = config.Cam2Source; } if (CheckProperty(config.NoteBookSource)) { NoteBookSource = config.NoteBookSource; } if (CheckProperty(config.LogoSource)) { LogoSource = config.LogoSource; } foreach (string item in logos) { Logos.Add(item); } }
// Update is called once per frame void FixedUpdate() { if (Active) { switch (ps) { case PlayerState.Grounded: GroundedMovement(); break; case PlayerState.Air: AirMovement(); break; case PlayerState.Dash: DashMovement(); break; } int r = coll.OverlapCollider(triggers, triggered); for (int i = 0; i < r; i++) { TriggerAction s = triggered[i].gameObject.GetComponent <TriggerAction>(); if (s) { s.PlayerTriggered(this.gameObject.GetComponent <Player>()); } } moveAxis = 0; yAxis = 0; jumpPressed = false; } }
public void UpdateTrigger(InputHelpers.Button button, AsimState state, TriggerAction action) { var(controller, ray) = GetCurrent(); switch (state) { case AsimState.Down: if (GetTriggerDown(button)) { action?.Invoke(controller, ray); } break; case AsimState.Hold: if (GetTrigger(button)) { action?.Invoke(controller, ray); } break; case AsimState.Up: if (GetTriggerUp(button)) { action?.Invoke(controller, ray); } break; } }
internal static bool ToolTipIsEnabled(DependencyObject o, TriggerAction triggerAction) { object tooltipObject = GetToolTip(o); if ((tooltipObject != null) && GetIsEnabled(o)) { // determine whether tooltip-on-keyboard-focus is enabled bool enableOnKeyboardFocus = true; if (triggerAction == TriggerAction.KeyboardFocus) { // attached property on owner has first priority bool?propertyValue = GetShowsToolTipOnKeyboardFocus(o); // if that doesn't say, get the value from the ToolTip itself (if any) if (propertyValue == (bool?)null) { ToolTip tooltip = tooltipObject as ToolTip; if (tooltip != null) { propertyValue = tooltip.ShowsToolTipOnKeyboardFocus; } } // the behavior is enabled, unless explicitly told otherwise enableOnKeyboardFocus = (propertyValue != false); } if ((PopupControlService.IsElementEnabled(o) || GetShowOnDisabled(o)) && enableOnKeyboardFocus) { return(true); } } return(false); }
private void OnEat(ConsumableInfo info) { if (info.m_ConsumeEffect != ConsumeEffect.None && UnityEngine.Random.Range(0f, 1f) <= info.m_ConsumeEffectChance && info.m_ConsumeEffectLevel >= 0) { PlayerDiseasesModule.Get().RequestDisease(info.m_ConsumeEffect, info.m_ConsumeEffectDelay, info.m_ConsumeEffectLevel); } PlayerDiseasesModule.Get().OnEat(info); PlayerInjuryModule.Get().OnEat(info); if (info.m_Disgusting) { PlayerAudioModule.Get().PlayEatingDisgustingSound(1f, false); } else { PlayerAudioModule.Get().PlayEatingSound(1f, false); } EventsManager.OnEvent(Enums.Event.Eat, 1, (int)info.m_ID); PlayerSanityModule.Get().OnEat(info.m_SanityChange); Localization localization = GreenHellGame.Instance.GetLocalization(); HUDMessages hudmessages = (HUDMessages)HUDManager.Get().GetHUD(typeof(HUDMessages)); string text = string.Empty; if (info.m_ConsumeEffect == ConsumeEffect.FoodPoisoning) { text = info.m_ConsumeEffectLevel.ToString("F0") + " " + localization.Get("HUD_FoodPoisoning"); hudmessages.AddMessage(text, null, HUDMessageIcon.FoodPoisoning, string.Empty); } if (info.m_AddEnergy > 0f) { text = info.m_AddEnergy.ToString("F0") + " " + localization.Get("HUD_Energy"); hudmessages.AddMessage(text, null, HUDMessageIcon.Energy, string.Empty); } if (info.m_Water > 0f) { text = info.m_Water.ToString("F0") + " " + localization.Get("HUD_Hydration"); hudmessages.AddMessage(text, null, HUDMessageIcon.Hydration, string.Empty); } if (info.m_Fat > 0f) { text = info.m_Fat.ToString("F0") + " " + localization.Get("HUD_Nutrition_Fat"); hudmessages.AddMessage(text, null, HUDMessageIcon.Fat, string.Empty); } if (info.m_Proteins > 0f) { text = info.m_Proteins.ToString("F0") + " " + localization.Get("HUD_Nutrition_Protein"); hudmessages.AddMessage(text, null, HUDMessageIcon.Proteins, string.Empty); } if (info.m_Carbohydrates > 0f) { text = info.m_Carbohydrates.ToString("F0") + " " + localization.Get("HUD_Nutrition_Carbo"); hudmessages.AddMessage(text, null, HUDMessageIcon.Carbo, string.Empty); } text = localization.Get(TriggerAction.GetTextPerfect(TriggerAction.TYPE.Eat)) + ": " + info.GetNameToDisplayLocalized(); hudmessages.AddMessage(text, null, HUDMessageIcon.Item, info.m_IconName); ItemsManager.Get().OnEat(info); if (info.m_ID == ItemID.coca_leafs) { PlayerCocaineModule.Get().OnEatCocaine(); } }
public static TriggerAction CreateTriggerAction() { TriggerAction asset = ScriptableObject.CreateInstance <TriggerAction>(); AssetDatabase.CreateAsset(asset, GetSelectedPathOrFallback() + "/TriggerAction.asset"); AssetDatabase.SaveAssets(); return(asset); }
private StubTrigger AttachAction(TriggerAction triggerAction, SysWindows::DependencyObject obj) { WindowedStubTrigger trigger = new WindowedStubTrigger(); trigger.Actions.Add(triggerAction); Interaction.GetTriggers(obj).Add(trigger); return(trigger); }
public override void ExecuteAction(TriggerAction trigger, GameObject invoker) { if (isTrigger) { return; } base.ExecuteAction(trigger, invoker); Unlock(); }
bool ScriptCallback(ColorMessage msg, Match match, object userdata) { if (m_scriptAction == null) { string parsedScript = TriggerManager.TriggerSubst.ReplaceScript(m_script); m_scriptAction = PythonInterface.PythonEngine.CreateMethod <TriggerAction>(parsedScript); } return(m_scriptAction(msg, match, userdata)); }
public static TriggerActionItem GetTriggerActionItem(TriggerAction triggerAction, DependencyObject source, TriggerSource triggerSource) { TriggerActionItem triggerActionItem; triggerActionItem = new TriggerActionItem(triggerAction, source); triggerActionItem.Initialize(); return(triggerActionItem); }
public override void ExecuteAction(TriggerAction trigger, GameObject invoker) { base.ExecuteAction(trigger, invoker); if (oneShotClip != null) { audio.PlayOneShot(oneShotClip); } else { audio.Play(); } }
private void _AddTrigger(string nextState, TriggerAction actionType) { mCurStateMap.Dic_name_triggers[nextState].Add (new StateTriggers() { param = new string[0], trigger = actionType }); _RefreshPanel(); }
public void UpdateTrigger(InputHelpers.Button button, AsimState state, TriggerAction action) { foreach (var controller in m_controllers) { if (controller.IsActive(button, state)) { action.Invoke(controller.Controller, controller.Ray); } } }
public void Launch(TriggerAction trigger = null) { float r = (float)Math.Round(UnityEngine.Random.Range(0.0f, 1.0f), 1); print("Try to do action with probability: " + r + ", prob " + probability + ", activate ? " + (r <= probability)); if (active && r <= probability) { if (desactiveAfter) active = false; Run(trigger); } }
public void TriggerTargets(TriggerAction action) { foreach (Triggerable t in targets) { // Check in case a target is destroyed if (t != null) { t.Trigger(action); } } }
public override void clear() { this._isFinish = true; this.applyTarget.removeBuff(this); base.clear(); this._target = null; this._owner = null; Utils.clearObject(this.triggerAction); this.triggerAction = null; this._buffType = null; this._data = null; }
public void Compile() { if (m_triggerType == TriggerType.Script) { string parsedScript = TriggerManager.TriggerSubst.ReplaceScript(m_script); m_scriptAction = PythonInterface.PythonEngine.CreateMethod <TriggerAction>(parsedScript); } else { m_subst = new TriggerManager.TriggerSubst(m_script); } }
void checkIfActor(Collider collider, TriggerAction action) { if (collider.TryGetComponent(out Actor newActor)) { if (action == TriggerAction.ENTER) { tryAddActor(newActor); } else if (action == TriggerAction.EXIT) { tryRemoveActor(newActor); } } }
/// <summary> /// Invokes a <see cref="TriggerAction"/> with the specified parameter. /// </summary> /// <param name="action">The <see cref="TriggerAction"/>.</param> /// <param name="parameter">The parameter value.</param> public static void Invoke(this TriggerAction action, object parameter) { ManualTrigger trigger = new ManualTrigger(); trigger.Actions.Add(action); try { trigger.Invoke(parameter); } finally { trigger.Actions.Remove(action); } }
/// <summary> /// Invokes a <see cref="TriggerAction"/>. /// </summary> /// <param name="action">The <see cref="TriggerAction"/>.</param> public static void Invoke(this TriggerAction action) { ManualTrigger trigger = new ManualTrigger(); trigger.Actions.Add(action); try { trigger.Invoke(null); } finally { trigger.Actions.Remove(action); } }
public void Launch(TriggerAction trigger = null) { float r = (float)Math.Round(UnityEngine.Random.Range(0.0f, 1.0f), 1); print("Try to do action with probability: " + r + ", prob " + probability + ", activate ? " + (r <= probability)); if (active && r <= probability) { if (desactiveAfter) { active = false; } Run(trigger); } }
public override void Run(TriggerAction trigger) { if (isRunning) { Stop(); return; } isRunning = true; GameObject.FindWithTag ("Player").GetComponent<MovePlayer>().canMove = false; dialogPanel.transform.GetChild (0).gameObject.SetActive (true); dialogPanel.transform.GetChild (0).GetChild (0).GetComponent<Text> ().text = characterName; textTween = dialogPanel.transform.GetChild (0).GetChild (1).GetComponent<Text> ().DOText ( text, 2f, true, ScrambleMode.None, null); if(question) dialogPanel.transform.GetChild (1).gameObject.SetActive (true); if (desactiveAfter) active = true; }
public void SetType() { this.runFunction = TriggerAction.KillBox; }
public AutoNotifyUsagePassiveSkillTrigger(UsageTriggerSkill skill, TriggerPredicate canExecute, TriggerAction execute, TriggerCondition condition) : this(skill, new RelayTrigger(canExecute, execute, condition)) { }
public AutoNotifyPassiveSkillTrigger(TriggerSkill skill, TriggerAction execute, TriggerCondition condition) : this(skill, new RelayTrigger(execute, condition)) { }
public override void Run(TriggerAction trigger) { money.addMoney(amount); }
public override void Visit(TriggerAction node) { this.action(node); }
// Use this for initialization void Start() { normalColor = popup.color; popup.color = new Color(normalColor.r, normalColor.g, normalColor.b, 0); trigger = gameObject.GetComponent<TriggerAction>(); }
internal abstract void GetTriggerInfo ( SmiEventSink eventSink, out bool[] columnsUpdated, out TriggerAction action, out SqlXml eventInstanceData );
public RelayTrigger(TriggerAction action, TriggerCondition condition) { CanExecute = (p, a, e) => { return true; }; Execute = action; Condition = condition; }
public override void ExplicitVisit(TriggerAction fragment) { _fragments.Add(fragment); }
public override void Run(TriggerAction trigger) { money.decreaseMoney(amount); }
public RelayTrigger(TriggerPredicate predicate, TriggerAction action, TriggerCondition condition) { CanExecute = predicate; Execute = action; Condition = condition; }
public void SetType(int damage) { this.damage = damage; this.runFunction = TriggerAction.DamageBox; }
public override void Run(TriggerAction trigger) { if (trigger == null) base.Run(trigger); }
public void SetType(string dialogueKey) { this.dialogueKey = dialogueKey; this.runFunction = TriggerAction.OpenDialogue; }
internal SqlTriggerContext(TriggerAction triggerAction, bool[] columnsUpdated, SqlXml eventInstanceData) { _triggerAction = triggerAction; _columnsUpdated = columnsUpdated; _eventInstanceData = eventInstanceData; }
public override void Run(TriggerAction trigger) { life.hit(amount); }
public abstract void Run(TriggerAction trigger = null);
public override void ExecuteAction(TriggerAction trigger, GameObject invoker) { timeStarted = Time.time; }