void OnEnable() { Data?.UpdateItems(this); OnItemFocused.AddListener(UpdateSelectedItem); if (UI) { OnItemFocused.AddListener(UI.UpdateSelectedItemUI); } Controller?.UpdateLockItems(); }
private void Start() { //SetupOwnerAndHeight(); onEnter.AddListener(OnEnter); onStay.AddListener(OnStay); onExit.AddListener(OnExit); }
private void Start() { if (takeDamageEvent == null) { takeDamageEvent = new GameObjectEvent(); } takeDamageEvent.AddListener((gameObject) => { loseEvent.Invoke(gameObject); }); }
private void Start() { //listen to events OnPlatformBelowChange.AddListener(InvokeOnTouchPlatformRPC); platformDetector.OnObjectChange.AddListener(SetPlatformBelow); platformDetector.OnObjectLeave.AddListener(ProcessOnLeavePlatform); //init misc streakMisses = 0; PlatformBelow = platformDetector.ObjectDetected; }
/// <summary> /// Executes the given function when the player loads, with the player's gameobject as a parameter. /// </summary> /// <param name="func"></param> public static void CallOnLocalPlayerSet(UnityAction <GameObject> func) { if (localPlayerInstance == null) { OnLocalPlayerSet.AddListener(func); } else { func(localPlayerInstance.gameObject); } }
void Start() { OnPlayerReady.AddListener(HandleOnPlayerReady); loadOperations = new List <AsyncOperation>(); Random.InitState(1); tileSize = 3 * Meteor.GetComponent <SpriteRenderer>().sprite.bounds.max.x; CS = ChooseCollision(); GenerateField(); line = this.gameObject.AddComponent <LineRenderer>(); // Set the width of the Line Renderer line.SetWidth(0.05F, 0.05F); // Set the number of vertex fo the Line Renderer line.positionCount = 2; }
public static void StartListening(string eventName, UnityAction <GameObject> listener) { GameObjectEvent thisEvent = null; if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { thisEvent.AddListener(listener); } else { thisEvent = new GameObjectEvent(); thisEvent.AddListener(listener); instance.eventDictionary.Add(eventName, thisEvent); } }
/// <summary> /// Subscribe a class to an Event of name contained in eventName. /// </summary> /// <param name="eventName">Name of the event to listen for.</param> /// <param name="listener">Action variable from the subscribing class (must not be null).</param> public static void StartListening(string eventName, UnityAction <GameObject> listener) { //Sets the current event to null? UnityEvent <GameObject> thisEvent = null; //If the instance is trying to get an event...? if (instance.eventDictionary.TryGetValue(eventName, out thisEvent)) { //Then it adds a listener to that event? thisEvent.AddListener(listener); } else { //If the event does not exist then set "thisEvent" to the new GameObject event? thisEvent = new GameObjectEvent(); // thisEvent.AddListener(listener); //Adds the event to the event manager instance.eventDictionary.Add(eventName, thisEvent); } }
private void OnEnable() { trapIconPressed.AddListener(OnTrapIconPressed); trapIconRelesed.AddListener(OnTrapIconRelesed); }
public void AddPostRunEvent(UnityAction <GameObject> hAction) { m_hPostRunEvent?.AddListener(hAction); }
public void AddListener(UnityAction <GameObject> call) { OnPossesPowerUse.AddListener(call); }
private void Start() { PlayerKilled = new GameObjectEvent(); PlayerKilled.AddListener(GameManager.Instance.OnPlyerKilled); }
private void OnEnable() { wallEvent.AddListener(EnqueueWall); }