void interactionRaisEvent(Collision col, VoidEvent eventToTrigger) { wasRaisedThisFrame = false; if (checkInteractionBy == Filter.Tag) { if (col.gameObject.CompareTag(tagToLookFor)) { eventToTrigger.Raise(); if (isOneTimeEvent) { gameObject.SetActive(false); Destroy(gameObject); } wasRaisedThisFrame = true; } } //safety so we don't encounter a nullpointer if if (checkInteractionBy == Filter.Object) { if (collidableObject == null) { return; } if (col.gameObject == collidableObject) { eventToTrigger.Raise(); if (isOneTimeEvent) { gameObject.SetActive(false); Destroy(gameObject); } wasRaisedThisFrame = true; } } }
public void Setup(VoidEvent evt, UnityAction action) { @event = evt; reaction = new UnityReaction(); reaction.AddListener(action); OnEnable(); }
// Use this function to unregister a callback function with this script public void UnRegisterCallback(VoidEvent cbFunction) { // If events are enabled, unregister the callback function from the event list if (_enableEvents) _voidEventCallbackList.Remove(cbFunction); else Debug.LogWarning("AnimateTiledTextureOnTrail: You are attempting to un-register a callback but the events of this object are not enabled!"); }
public void OnEventFired(VoidEvent evt) { if (responseDelay <= 1e-2f) { response?.Invoke(); } else { Conditional.Wait(responseDelay).Do(() => { response?.Invoke(); }); } }
public void UnRegisterCallback(VoidEvent cbFunction) { if (_enableEvents) { _voidEventCallbackList.Remove(cbFunction); } else { Debug.LogWarning("AnimateTiledTexture: You are attempting to un-register a callback but the events of this object are not enabled!"); } }
// Use this function to unregister a callback function with this script public void UnRegisterCallback(VoidEvent cbFunction) { // If events are enabled, unregister the callback function from the event list if (_enableEvents) { _voidEventCallbackList.Remove(cbFunction); } else { Debug.LogWarning("AnimateTiledTextureOnTrail: You are attempting to un-register a callback but the events of this object are not enabled!"); } }
private List <VoidEvent> _voidEventCallbackList; // A list of functions we need to call if events are enabled // Use this function to register your callback function with this script public void RegisterCallback(VoidEvent cbFunction) { // If events are enabled, add the callback function to the event list if (_enableEvents) { _voidEventCallbackList.Add(cbFunction); } else { Debug.LogWarning("AnimateTiledTexture: You are attempting to register a callback but the events of this object are not enabled!"); } }
public static T SendEvent <T>(this object context, T evt, int channel = EventManager.DefaultChannel) where T : Event, new() { if (evt == null) { using (var voidEvt = VoidEvent.Get()) EventManager.SendEvent(voidEvt, context, channel); return(null); } return(EventManager.SendEvent(evt, context, channel)); }
// Read variables from JSON data. private void Tune() { JSONNode json = JSON.Parse(voidEventsJSON.ToString()); // Read JSON data for tier-specific data. JSONNode nodeTierData = json["tier-specific data"]; for (int i = 0; i < nodeTierData.Count; ++i) { JSONNode nodeTier = nodeTierData[i]; int tier = nodeTier["tier"].AsInt; int radiationVestigeCount = nodeTier["radiation vestige count"].AsInt; tierToVestigeCount.Add(tier, radiationVestigeCount); int radiationVestigeLevel = nodeTier["radiation vestige level"].AsInt; tierToVestigeLevel.Add(tier, radiationVestigeLevel); int radiationBEDRB = nodeTier["radiation base energy decay rate bonus"].AsInt; tierToDecayBonus.Add(tier, radiationBEDRB); int asteroidCount = nodeTier["asteroid count"].AsInt; tierToAsteroidCount.Add(tier, asteroidCount); } // Read the actual void event JSON data. JSONNode nodeEvents = json["events"]; for (int i = 0; i < nodeEvents.Count; ++i) { JSONNode nodeEvent = nodeEvents[i]; int begin = nodeEvent["begin"].AsInt; int end = nodeEvent["end"].AsInt; JSONArray types = nodeEvent["types"].AsArray; List <VoidEvent> myEvents = new List <VoidEvent>(); for (int j = 0; j < types.Count; ++j) { string typeString = types[j]; char tierLetter = typeString[0]; char typeLetter = typeString[1]; VoidEvent.EventType theType = letterBindings[typeLetter]; int tier = (int)char.GetNumericValue(tierLetter); VoidEvent newEvent = new VoidEvent(theType, tier); newEvent.Started += VoidEvent_Started; newEvent.Finished += VoidEvent_Finished; myEvents.Add(newEvent); } VoidEventGroup newEventGroup = new VoidEventGroup(myEvents, begin, end); newEventGroup.Started += VoidEventGroup_Started; voidEventGroups.Add(newEventGroup); } }
public override void OnInspectorGUI() { base.OnInspectorGUI(); GUI.enabled = Application.isPlaying; VoidEvent e = target as VoidEvent; if (GUILayout.Button("Raise")) { e.Raise(new Void()); } }
void Start() { attackEvent = new VoidEvent(); _animationHandler.CreateAnimationUnit("Punch", AnimatorControllerParameterType.Trigger, atomEvent: attackEvent); Transform player = AtomTags.FindByTag(playerTag.Value).transform; Observable.EveryUpdate().Buffer(TimeSpan.FromSeconds(eachXSeconds)) .Where(_ => attackAtThisDistance.Value >= Vector2.Distance(player.position, transform.position)) .Subscribe(_ => { _attackAction.Do(gameObject, player.position - transform.position); attackEvent.Raise(); }); }
public override bool UseItem(Player player) { if (!MyWorld.voidInvasionUp && !Main.dayTime) { Main.NewText("You feel a wave of cold rush over you...", 182, 15, 15, false); VoidEvent.StartInvasion(); return(true); } if (Main.dayTime) { Main.NewText("Your head throbs", 182, 15, 15, false); MyWorld.willStartVoidInvasion = true; return(true); } else { return(false); } }
void interactionRaisEvent(Collider other, VoidEvent eventToTrigger) //trigger { wasRaisedThisFrame = false; if (checkInteractionBy == Filter.Tag) { if (other.gameObject.CompareTag(tagToLookFor)) { eventToTrigger.Raise(); if (isOneTimeEvent) { if (gameObject.activeSelf) { gameObject.SetActive(false); } wasUsedThisPlaythrough = true; } wasRaisedThisFrame = true; } } //safety so we don't encounter a nullpointer if if (checkInteractionBy == Filter.Object) { if (collidableObject == null) { return; } if (other.gameObject == collidableObject) { eventToTrigger.Raise(); if (isOneTimeEvent) { if (gameObject.activeSelf) { gameObject.SetActive(false); } wasUsedThisPlaythrough = true; } wasRaisedThisFrame = true; } } }
public void AddListener(string key,VoidEvent callback) { }
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { VoidEvent voidEvent = animator.GetComponent <VoidEvent>(); voidEvent.OnFired(); }
// Use this function to register your callback function with this script public void RegisterCallback(VoidEvent cbFunction) { // If events are enabled, add the callback function to the event list if (_enableEvents) _voidEventCallbackList.Add(cbFunction); else Debug.LogWarning("AnimateTiledTexture: You are attempting to register a callback but the events of this object are not enabled!"); }
static internal void PutInDic(this VoidEvent @void) { PutInDic(@void, string.Format("{0}{1}", defaultKey, nameof(VoidEvent))); }
static internal void PutInDic(this VoidEvent @void, out string key) { key = string.Format("{0}{1}{2}", defaultKey, nameof(VoidEvent), KeyForXY(UnityEngine.Random.Range(1, 20), UnityEngine.Random.Range(1, 99))); PutInDic(@void, key); }
public static void AddOnce(this VoidEvent thisEvent, UnityAction reciever) { thisEvent.RemoveListener(reciever); thisEvent.AddListener(reciever); }
static internal void PutInDic(this VoidEvent @void, string key) { PutInDic((OLiOEvent)@void, key); }
/// <summary> /// UEvent数据写入无返回值字典 /// </summary> /// <param name="void">UEvent</param> public void PutUEventInVoidDic(VoidEvent @void) { @void.PutInDic(); }
public void SetAnimationEndAction(VoidEvent action) { button.onEndAnimation = action; }
public void SetAction(VoidEvent action) { onClick = action; }
/// <summary> /// UEvent数据写入无返回值字典 /// </summary> /// <param name="void">UEvent</param> /// <param name="key">返回键</param> public void PutUEventInVoidDic(VoidEvent @void, out string key) { @void.PutInDic(out key); }
private void PrintToLog_(VoidEvent evt) => LOG.Write("Bar");