private void OnTriggerStay(Collider other) { if (other.gameObject.layer == 8) { objectDetected.Invoke(other); } }
public void Select(UIListItem item) { if ((!_allowReselectSame && item.isSelected) || !_listItems.Contains(item)) { return; } _listItems.ForEach(li => li.SetSelected(li == item)); selectedValue = item.item; _onSelected?.Invoke(selectedValue); }
public void FixedUpdate() { #if UNITY_EDITOR if (!Application.isPlaying) { return; } #endif if (Animator != null && ActivatedBoolHash != 0) { Animator.SetBool(ActivatedBoolHash, Activated); } if (Activators.Count <= 0) { return; } OnActivateStay.Invoke(Activator); foreach (var activator in new List <HedgehogController>(Activators)) { OnActivatorStay.Invoke(activator); } }
/// <summary> /// Deactivates the object with the ability to specify the controller that deactivated it, if any. /// </summary> /// <param name="controller"></param> public void Deactivate(HedgehogController controller = null) { if (controller != null) { Activators.Remove(controller); OnActivatorExit.Invoke(controller); } var any = Activators.Any(); if (!AllowMultiple && any) { return; } if (!any) { Activated = false; } if (DeactivateSound != null) { SoundManager.Instance.PlayClipAtPoint(DeactivateSound, transform.position); } OnDeactivate.Invoke(controller); BubbleEvent(controller, true); }
public static void TriggerEvent(string eventName, object data = null, GameObject trigger = null) //adds a new event in the dictionary { ObjectEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(data, trigger); } }
void Fire() { //Instantiate (projectilePrefab, transform.position, transform.rotation); GameObject obj = projectilePrefab.GetInstance(); obj.transform.position = transform.position; obj.transform.rotation = transform.rotation; OnFire.Invoke(obj); }
public static void TriggerEvent(string eventName, object obj) { ObjectEvent thisEvent = null; if (instance.objectEventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(obj); } }
public static void Send(string eventName, object[] param) { ObjectEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.Invoke(param); } }
void Captured(team t) { startTime = false; timer = 0.0f; if (t == team.red) { controlled = team.red; myLight.color = new Color(1.0f, 0.0f, 0.0f, 1.0f); GetComponent <MeshRenderer>().material.color = new Color(1.0f, 0.0f, 0.0f, 0.588f); ObjectiveSecured.Invoke(team.red, this); } else if (t == team.blue) { controlled = team.blue; myLight.color = new Color(0.0f, 0.682f, 1.0f, 1.0f); GetComponent <MeshRenderer>().material.color = new Color(0.0f, 0.685f, 1.0f, 0.588f); ObjectiveSecured.Invoke(team.blue, this); } }
private void SetUnityObject(UnityObject obj) { if (!isSceneObject) { throw new NotSupportedException($"Non-scene objects are not supported."); } if (obj == null) { ModifyPropertyValue(new ComponentDataWrapper(0), true); onValueChanged.Invoke(null); } else { if (obj is ILevelEditorObject levelObject) { if (BoundProperty.Type == typeof(GameObject)) { ModifyPropertyValue(new ComponentDataWrapper(levelObject.MyGameObject), true); onValueChanged.Invoke(levelObject.MyGameObject); } else { Component value = levelObject.MyGameObject.GetComponent(BoundProperty.Type); ModifyPropertyValue(new ComponentDataWrapper(value), true); onValueChanged.Invoke(value); } } else if (obj is GameObject go) { ModifyPropertyValue(new ComponentDataWrapper(go), true); onValueChanged.Invoke(obj); } else { ModifyPropertyValue(new ComponentDataWrapper((Component)obj), true); onValueChanged.Invoke(obj); } } EndEdit(); UpdateLabel(obj); }
void OnTriggerEnter2D(Collider2D other) { GameObject gmOb = other.gameObject; int id = gmOb.GetInstanceID(); if (gmOb.layer == 8 && !hit_objects.Contains(id)) { hit_objects.Add(id); if (move == 1) { Move1.Invoke(gmOb); } else if (move == 2) { Move2.Invoke(gmOb); } else if (move == 3) { Move3.Invoke(gmOb); } } }
/// <summary> /// Activates the object with the ability to specify the controller that activated it, if any. /// </summary> /// <param name="controller"></param> public void Activate(HedgehogController controller = null) { if (!enabled || !gameObject.activeInHierarchy) { return; } if (Activators.Count > 0 && !AllowMultiple) { return; } if (controller != null && !Activators.Contains(controller)) { Activators.Add(controller); OnActivatorEnter.Invoke(controller); } var any = Activators.Any(); if (!AllowMultiple && any) { return; } Activated = true; if (ActivateSound != null) { SoundManager.Instance.PlayClipAtPoint(ActivateSound, transform.position); } OnActivate.Invoke(controller); BubbleEvent(controller); if (Animator != null && ActivatedTriggerHash != 0) { Animator.SetTrigger(ActivatedTriggerHash); } }
// Update is called once per frame void Update() { if (held && isCooking) { cookTime -= Time.deltaTime; print("Time left: " + cookTime); if (cookTime <= 0) { //Make the new one! GameObject next = ingredient.FinishCooking(performedAction); //Move it to the next one! Destroy(held); ObjectPlacement.instance.Replace(transform.position, next); onFinishCooking.Invoke(next); if (cookingParticles) { cookingParticles.Stop(); } StartCooking(next); } } }
public void SetOwner(GameObject newOwner) { owner = newOwner; OnChangeOwner.Invoke(owner); }
public virtual void SetObjectPicked(object obj) { onObjectPickedChanged.Invoke(obj); }
public void OnSignalRaised(object parameter) { Event.Invoke(parameter); }
public void PassObject(GameObject obj) { OnPickup.Invoke(obj); }
/// <summary> /// Calls the UnityEvent reponse when listener receives an event with a Unity Object value. /// </summary> public void OnEventRaised(Object value) { objectResponse.Invoke(value); }
public void OnEventRaised(object data) { Response.Invoke(data); }
public void Raise(object obj) { action?.Invoke(obj); }
private void OnTriggerEnter(Collider other) { triggerEvent.Invoke(other.gameObject); }