Ejemplo n.º 1
0
 internal void Update(GameTime gameTime)
 {
     if (_slideState == SlideState.TransitionOn)
     {
         _pos += (_transitionDir * 20);
         if (_pos == 0)
         {
             _slideState = SlideState.Active;
         }
         OnActivate?.Invoke(this, null);
     }
     else if (_slideState == SlideState.TransitionOff)
     {
         _pos += (_transitionDir * 20);
         if (Math.Abs(_pos) == BOUNDARY)
         {
             _slideState = SlideState.Inactive;
         }
         OnDeactivate?.Invoke(this, null);
     }
     else if (_slideState == SlideState.Active)
     {
         foreach (var r in _renderers)
         {
             r.Update(gameTime);
         }
     }
 }
 protected override void OnActivated(object sender, EventArgs args)
 {
     OnPreActivate.Raise(this, args);
     OnActivate.Raise(this, args);
     base.OnActivated(sender, args);
     OnPostActivate.Raise(this, args);
 }
Ejemplo n.º 3
0
    private void OnItemChosen(Action item)
    {
        Item localItem = (Item)item;

        localItem.UseItem();
        OnActivate.Invoke(item, _id);
        _itemMenu.SetOpenFlag(false);
    }
Ejemplo n.º 4
0
 public override void Tick(Phase triggerPhase)
 {
     base.Tick(triggerPhase);
     if (OnActivate != null)
     {
         OnActivate.Invoke();
     }
 }
Ejemplo n.º 5
0
 public void Activate()
 {
     _active = true;
     if (OnActivate != null)
     {
         OnActivate.Invoke(this);
     }
 }
Ejemplo n.º 6
0
 public void Activate()
 {
     active = true;
     foreach (var script in scripts)
     {
         script.enabled = true;
     }
     OnActivate?.Invoke(this, EventArgs.Empty);
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Activates the Quantum Console.
        /// </summary>
        /// <param name="shouldFocus">If the input field should be automatically focused.</param>
        public void Activate(bool shouldFocus = true)
        {
            Initialize();
            IsActive = true;
            _containerRect.gameObject.SetActive(true);
            OverrideConsoleInput(string.Empty, shouldFocus);

            OnActivate?.Invoke();
        }
Ejemplo n.º 8
0
 public void Check()
 {
     if (GameManager.Instance.LastCheckpoint != this)
     {
         OnActivate.Invoke();
         particleSystem.Play();
         ProgressionManager.Instance.SetLastActivatedCheckpoint(this);
     }
     GameManager.Instance.SetLastCheckpoint(this);
     animator.SetBool("isCollected", true);
 }
Ejemplo n.º 9
0
 void ISceneStateInternal.InternalActivate()
 {
     if (!isVisible)
     {
         isVisible = true;
         foreach (var it in OnActivate.Enumerate())
         {
             it.Do();
         }
     }
 }
Ejemplo n.º 10
0
    protected void Enter(ColliderType collider)
    {
        bool wasActive = Active;

        inside.Add(collider);
        OnEnter.Invoke(collider);

        if (!wasActive)
        {
            OnActivate.Invoke(collider);
        }
    }
Ejemplo n.º 11
0
    void CheckTrigger()
    {
        foreach (InputTrigger t in triggers)
        {
            if (!t.IsActive)
            {
                return;
            }
        }

        OnActivate.Invoke();
    }
Ejemplo n.º 12
0
 public void Activate()
 {
     if (powerReq > 0 && FindObjectOfType <GameManager>().GetPower() <= 0)
     {
         // Not enough power
     }
     else
     {
         active = true;
         OnActivate?.Invoke();
     }
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Interacts with objects with class InteractBase and triggers event OnActivate
 /// </summary>
 public void UseObject()
 {
     if (Input.GetKeyDown(KeyCode.E))
     {
         bUse = true;
         OnActivate?.Invoke(this);
         //Debug.Log("Player press E");
     }
     else
     {
         bUse = false;
     }
 }
Ejemplo n.º 14
0
 /// <summary>
 /// Changes bOpenInventory to true for listening objects like InventoryUI to respond to.
 /// </summary>
 public void UseInventory()
 {
     if (Input.GetKeyDown(KeyCode.Tab))
     {
         bUseInventory = true;
         OnActivate?.Invoke(this);
         Debug.Log("Player opens inventory");
     }
     else
     {
         bUseInventory = false;
     }
 }
        private void Start()
        {
            base.Start();

            if (IsOn)
            {
                // Active feature images
                Images.ForEach(image => image.gameObject.SetActive(true));

                // Deactivate sibling images
                GetSiblingImages().ForEach(image => image.gameObject.SetActive(false));
            }
            OnActivate.AddListener(() => StartCoroutine(ActivateImages()));
        }
Ejemplo n.º 16
0
 public void Activate()
 {
     //this could just as well be something like a synchronizer.
     //or subscription to the ServerEventsClient
     // anything that can be enabled / disabled.
     lbltimer.Interval = 1000;
     lbltimer.Tick    += Lbltimer_Tick;
     timer.Interval    = 5000;
     timer.Tick       += Timer_Tick;
     timer.Start();
     lbltimer.Start();
     OnActivate?.Invoke(this, new EventArgs());
     _IsActive = true;
 }
        private void DoActivate()
        {
            if (!IsEnabled)
            {
                try
                {
                    OnActivate?.Invoke(this, EventArgs.Empty);

                    IsEnabled = true;
                }
                catch (Exception ex)
                {
                    Logger.Error("Failed to activate component.", ex);
                }
            }
        }
Ejemplo n.º 18
0
        protected override void OnInitialized()
        {
            base.OnInitialized();

            OnActivate
            .Subscribe(_ => OnActivated(), Debug.LogError)
            .AddTo(this);
            OnDeactivate
            .Subscribe(_ => OnDeactivated(), Debug.LogError)
            .AddTo(this);

            if (_lazyActivation)
            {
                Activate();
            }
        }
Ejemplo n.º 19
0
 /// <summary>
 /// CBTProc callback function.
 /// </summary>
 /// <param name="nCode">The code that the hook procedure uses to determine how to process the message.</param>
 /// <param name="wParam">Specifies the handle to the window about to be activated.</param>
 /// <param name="lParam">Specifies a long pointer to a CBTACTIVATESTRUCT structure containing the handle to the active window and specifies whether the activation is changing because of a mouse click.</param>
 /// <returns></returns>
 protected override void Hook2Procedure(
     IntPtr hWinEventHook,
     uint eventType,
     IntPtr hWnd,
     int idObject,
     int idChild,
     uint dwEventThread,
     uint dwmsEventTime
     )
 {
     if (eventType == EVENT_SYSTEM_FOREGROUND)
     {
         var process = GetActiveProcess(hWnd);
         OnActivate?.Invoke(this, new EventArgs <Process>(process));
     }
 }
Ejemplo n.º 20
0
 protected override void Activate()
 {
     try
     {
         if (OnActivate != null)
         {
             OnActivate.Execute(this, new EventParams());
         }
     }
     catch (Exception exception)
     {
         this.HandleException(exception);
     }
     UpdateText();
     base.Activate();
 }
Ejemplo n.º 21
0
 protected override void Activate()
 {
     base.Activate();
     UpdateIconImage();
     UpdateBackgroundImage();
     try
     {
         if (OnActivate != null)
         {
             OnActivate.Execute();
         }
     }
     catch (Exception exception)
     {
         WebSession.ErrorList.Add(exception);
     }
 }
Ejemplo n.º 22
0
        public SpriteButton(int index, Button buttonElement)
        {
            Element = buttonElement;
            Index   = index;

            OnActivate.AddListener(delegate
            {
                Element.onClick.Invoke();
            });

            OnSelect.AddListener(delegate
            {
                Element.OnPointerEnter(null);
            });

            OnUnselect.AddListener(delegate
            {
                Element.OnPointerExit(null);
            });
        }
Ejemplo n.º 23
0
        public bool TryActivate(Player player, List <ComboInput> inputs)
        {
            // if received input count is lower, we won't be able to activate the combo
            if (inputs.Count < RequiredInputs.Count)
            {
                return(false);
            }

            if (SteamHelper.AmIBanned)
            {
                Main.NewText("Your massive amounts of cringe caused " + TBARPlayer.Get(player).PlayerStand.StandName + " to refuse moving even a muscle for you");
                Main.NewText("It states that you: " + SteamHelper.BanReason);
                return(false);
            }

            // find diffrence so we only check the last "answer"
            // e.g: we press A1-A1-Up-Down; combo is just Up-Down
            // it will skip over A1-A1 and only check the last 2 inputs
            int dif = Math.Abs(RequiredInputs.Count - inputs.Count);

            for (int i = 0 + dif; i < inputs.Count; i++)
            {
                if (inputs[i] != RequiredInputs[i - dif])
                {
                    return(false);
                }
            }

            DrawHelper.CircleDust(player.Center, Vector2.Zero, 6, 8, 8, 1.85f);

            OnActivate?.Invoke(player);

            SendPacket(player, ComboName, player.whoAmI);

            if (!Main.dedServ)
            {
                ComboTimeRunner.AchievedCombo = true;
            }

            return(true);
        }
Ejemplo n.º 24
0
 public void Activate(Hashtable parameters)
 {
     LastParameters = parameters;
     OnActivate?.Invoke(this, parameters);
     IsActive = true;
 }
 public void Activate()
 {
     OnActivate?.Invoke();
 }
Ejemplo n.º 26
0
 public void ForceActivate(Player player)
 {
     OnActivate?.Invoke(player);
 }
 protected void Activate()
 {
     Active = true;
     OnActivate?.Invoke(this);
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Attaches generic delegates to the class for invokation
 /// </summary>
 /// <param name="func"></param>
 public void AttachAction(OnActivate func)
 {
     onActivate += func;
 }
Ejemplo n.º 29
0
 public void InvokeCallback()
 {
     OnActivate.Invoke(this);
 }
Ejemplo n.º 30
0
 private void Activate()
 {
     OnActivate?.Invoke(this);
 }