Exemplo n.º 1
0
        protected void RegisterState(BoolEvent evt, UnityAction <bool> call, OwnershipMode mode = OwnershipMode.OnGrabbed)
        {
            if (networkMode == NetworkMode.Standalone)
            {
                evt.AddListener(call);
            }
 #if USING_PHOTON
            else
            {
                PhotonBool photon = gameObject.GetComponent <PhotonBool>();
                if (photon == null)
                {
                    photon = gameObject.AddComponent <PhotonBool>();
                }

                photon.AddClient(evt, call);

                if (mode == OwnershipMode.OnGrabbed)
                {
                    onGrab.AddListener(photon.ChangeOwnership);
                }
                else
                {
                    onFocus.AddListener(photon.ChangeOwnership);
                }
            }
#endif
        }
Exemplo n.º 2
0
    public override void OnLoadSystem()
    {
        startTime   = new DateTime(year, month, day, hour, 0, 0);
        currentTime = startTime;

        pauzeEvent?.AddListener(OnGamePauzed);
    }
Exemplo n.º 3
0
 public Elm(PhotonBool s, BoolEvent evt, UnityAction <bool> call, int w)
 {
     state = s;
     which = w;
     onChanged.AddListener(call);
     evt.AddListener(Change);
 }
Exemplo n.º 4
0
 public void AddOnActivityChangeListener(UnityAction <bool> listener)
 {
     if (onIsActiveChange == null)
     {
         onIsActiveChange = new BoolEvent();
     }
     onIsActiveChange.AddListener(listener);
 }
Exemplo n.º 5
0
 private void Start()
 {
     if (resetEvent == null)
     {
         resetEvent = new BoolEvent();
     }
     resetEvent.AddListener(CleanUp);
 }
Exemplo n.º 6
0
    public static void Subscribe(this BoolEvent e, UnityAction <Boolean> action)
    {
        if (e == null || action == null)
        {
            return;
        }

        e.AddListener(action);
    }
Exemplo n.º 7
0
        public void BoolEventTest()
        {
            var e       = new BoolEvent();
            int counter = 0;

            e.AddListener((val) => counter += (1 + (val ? 1 : 0)));
            Assert.AreEqual(counter, 0);
            e.Invoke(false);
            Assert.AreEqual(counter, 1);
            e.Invoke(true);
            e.Invoke(true);
            Assert.AreEqual(counter, 5);
        }
Exemplo n.º 8
0
    public override void OnLoadSystem()
    {
        if (cursorTexture != null)
        {
            UnityEngine.Cursor.SetCursor(cursorTexture, Vector2.zero, CursorMode.ForceSoftware);
        }

#if UNITY_STANDALONE || UNITY_WEBGL
        mouseInteraction?.AddListener(OnMouseInteraction);
#endif

        onPressInteractionButtonMouse?.AddListener(OnMouseInteractionButton);
        onPauzeGame?.AddListener(OnPauzeGame);
    }
Exemplo n.º 9
0
        protected void RegisterState(BoolEvent evt, UnityAction <bool> call)
        {
            if (networkMode == NetworkMode.Standalone)
            {
                evt.AddListener(call);
            }
 #if USING_PHOTON
            else
            {
                PhotonBool photon = gameObject.AddComponent <PhotonBool>();
                photon.onChanged.AddListener(call);
                evt.AddListener(photon.Change);
                if (networkMode == NetworkMode.NetworkOnGrab)
                {
                    onGrab.AddListener(photon.ChangeOwnership);
                }
                else
                {
                    onFocus.AddListener(photon.ChangeOwnership);
                }
            }
#endif
        }
Exemplo n.º 10
0
    public static void StartListeningBool(string eventName, UnityAction <bool> listener)
    {
        BoolEvent thisBoolEvent = null;

        if (instance.BoolEventDictionary.TryGetValue(eventName, out thisBoolEvent))
        {
            thisBoolEvent.AddListener(listener);
        }
        else
        {
            thisBoolEvent = new BoolEvent();
            thisBoolEvent.AddListener(listener);
            instance.BoolEventDictionary.Add(eventName, thisBoolEvent);
        }
    }
Exemplo n.º 11
0
    public static void StartListening(BooleanEventName eventName, UnityAction <bool> listener)
    {
        UnityEvent <bool> thisEvent = null;

        if (Instance.m_eventWithBoolDictionary.TryGetValue(eventName, out thisEvent))
        {
            thisEvent.AddListener(listener);
        }
        else
        {
            thisEvent = new BoolEvent();
            thisEvent.AddListener(listener);
            Instance.m_eventWithBoolDictionary.Add(eventName, thisEvent);
        }
    }
Exemplo n.º 12
0
    private void Awake()
    {
        currentPlayer = GameObject.FindObjectOfType <PlayerController>();
        m_Rigidbody2D = GetComponent <Rigidbody2D>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }

        OnCrouchEvent.AddListener(Dash);
    }
Exemplo n.º 13
0
    private void Awake()
    {
        mouseWorldInput?.AddListener(OnMouseMove);
        onGamePauzed?.AddListener(OnGamePauze);

        selectionGameObject = new GameObject();
        selectionGameObject.transform.SetParent(this.transform);
        selectionSpriteRenderer              = selectionGameObject.AddComponent <SpriteRenderer>();
        selectionSpriteRenderer.sprite       = cursorSprite;
        selectionSpriteRenderer.sortingOrder = -500;
        selectionSpriteRenderer.color        = new Color(1, 1, 1, 0.25f);

#if UNITY_EDITOR
        selectionGameObject.name = "SelectionCursor";
#endif

        gridManagerReference.AddListener(OnFoundGridReference);
    }
Exemplo n.º 14
0
 private void Start()
 {
     OnCheckPassed.AddListener((passed) =>
     {
         if (passed)
         {
             TargetRate += 0.25f;
             //SecondsUntilNextCheck = Mathf.Max(10, secondsUntilNextCheck - 1);
             SecondsUntilNextCheck = SecondsUntilNextCheck;
         }
         else
         {
             OnGameFailed.Invoke();
             TargetRate = TargetRate;
             //SecondsUntilNextCheck = Mathf.Max(10, secondsUntilNextCheck - 5);
             SecondsUntilNextCheck = 0;
         }
     });
 }
Exemplo n.º 15
0
 public void AddListenerPossess(UnityAction <bool> call)
 {
     OnPosses.AddListener(call);
 }
Exemplo n.º 16
0
 public void AddToListener(UnityAction <bool> call)
 {
     myToggles.AddListener(call);
     call(isActive);
 }
Exemplo n.º 17
0
 public override void OnLoadSystem()
 {
     pauzeButton?.AddListener(OnPauzeButton);
     requestPauze?.AddListener(OnRequestPauze);
     pauzeEvent?.AddListener(OnPauze);
 }
Exemplo n.º 18
0
 public override void OnLoadSystem()
 {
     pauzeEvent?.AddListener(OnGamePauzed);
 }
 public static void AddOnce(this BoolEvent thisEvent, UnityAction <bool> reciever)
 {
     thisEvent.RemoveListener(reciever);
     thisEvent.AddListener(reciever);
 }
Exemplo n.º 20
0
 public virtual void AddListener(UnityAction <bool> call)
 {
     OnOpen.AddListener(call);
 }
Exemplo n.º 21
0
 private void OnEnable()
 {
     OnPressPauze.AddListener(OnPauzePressed);
     OnPauzeGame.AddListener(OnGamePauzed);
 }
Exemplo n.º 22
0
 void Awake()
 {
     strategicClock = this;
     PhaseChange.AddListener(TurnManagement);
     PauseEvent.AddListener(Pause);
 }
Exemplo n.º 23
0
 public void AddListener(UnityAction <bool> call)
 {
     evnt.AddListener(call);
 }
Exemplo n.º 24
0
 private void OnEnable()
 {
     playerMoveStateChange.AddListener(ChangePlayerMoveState);
 }