コード例 #1
0
 void OnEnable()
 {
     Data?.UpdateItems(this);
     OnItemFocused.AddListener(UpdateSelectedItem);
     if (UI)
     {
         OnItemFocused.AddListener(UI.UpdateSelectedItemUI);
     }
     Controller?.UpdateLockItems();
 }
コード例 #2
0
    private void Start()
    {
        //SetupOwnerAndHeight();

        onEnter.AddListener(OnEnter);
        onStay.AddListener(OnStay);
        onExit.AddListener(OnExit);
    }
コード例 #3
0
    private void Start()
    {
        if (takeDamageEvent == null)
        {
            takeDamageEvent = new GameObjectEvent();
        }

        takeDamageEvent.AddListener((gameObject) => { loseEvent.Invoke(gameObject); });
    }
コード例 #4
0
    private void Start()
    {
        //listen to events
        OnPlatformBelowChange.AddListener(InvokeOnTouchPlatformRPC);
        platformDetector.OnObjectChange.AddListener(SetPlatformBelow);
        platformDetector.OnObjectLeave.AddListener(ProcessOnLeavePlatform);

        //init misc
        streakMisses  = 0;
        PlatformBelow = platformDetector.ObjectDetected;
    }
コード例 #5
0
 /// <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);
     }
 }
コード例 #6
0
    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;
    }
コード例 #7
0
    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);
        }
    }
コード例 #8
0
    /// <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);
        }
    }
コード例 #9
0
ファイル: TrapPlacement.cs プロジェクト: Nuzumi/MazeNewUnity
 private void OnEnable()
 {
     trapIconPressed.AddListener(OnTrapIconPressed);
     trapIconRelesed.AddListener(OnTrapIconRelesed);
 }
コード例 #10
0
 public void AddPostRunEvent(UnityAction <GameObject> hAction)
 {
     m_hPostRunEvent?.AddListener(hAction);
 }
コード例 #11
0
 public void AddListener(UnityAction <GameObject> call)
 {
     OnPossesPowerUse.AddListener(call);
 }
コード例 #12
0
ファイル: EventsManager.cs プロジェクト: medmor/RPGGame
 private void Start()
 {
     PlayerKilled = new GameObjectEvent();
     PlayerKilled.AddListener(GameManager.Instance.OnPlyerKilled);
 }
コード例 #13
0
 private void OnEnable()
 {
     wallEvent.AddListener(EnqueueWall);
 }