Exemplo n.º 1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag(otherTag))
     {
         OnEnter?.Invoke();
     }
 }
 void OnTriggerEnter2D(Collider2D col)
 {
     if (col.gameObject.Equals(player))
     {
         OnEnter.Invoke(col);
     }
 }
Exemplo n.º 3
0
        void UpdateKey()
        {
            var           leftshift        = false;
            KeyboardState oldKeyboardState = _keystateCurrentKeyboardState;

            _keystateCurrentKeyboardState = Keyboard.GetState();

            Keys[] pressedKeys = _keystateCurrentKeyboardState.GetPressedKeys();
            if (_keystateCurrentKeyboardState.IsKeyDown(Keys.LeftShift))
            {
                leftshift = true;
            }
            foreach (Keys key in pressedKeys)
            {
                if (oldKeyboardState.IsKeyDown(key))
                {
                    continue;
                }

                var keyText = key.ToString();
                // ReSharper disable once ConvertIfStatementToSwitchStatement
                if (key == Keys.Back && _text?.Length >= 1) // overflows
                {
                    _text = _text.Remove(_text.Length - 1, 1);
                }
                else if (key == Keys.Enter)
                {
                    if (_text == null)
                    {
                        continue;
                    }

                    OnEnter?.Invoke(this, new TextFieldArgs(_text.ToUpper(CultureInfo.CurrentCulture)));
                    _text = null;
                }
                else if (key == Keys.Space)
                {
                    _text = _text?.Insert(_text.Length, " ");
                }
                else if (IsChar(key))
                {
                    if (leftshift)
                    {
                        _text += keyText;
                    }
                    else
                    {
                        _text += keyText.ToLower(CultureInfo.CurrentCulture);
                    }
                }
                else if (IsNum(key))
                {
                    _text += keyText.Remove(0, 1);
                }
                else if (key == Keys.OemQuestion)
                {
                    _text += "/";
                }
            }
        }
Exemplo n.º 4
0
 private void OnMouseEnter()
 {
     if (!_isMoving)
     {
         OnEnter?.Invoke(this, gameObject);
     }
 }
Exemplo n.º 5
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Player"))
     {
         OnEnter.Invoke(this, new PlayerEventArgs(0, false));
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// On exit, we reset our staying bool and invoke our OnExit event
 /// </summary>
 /// <param name="collider"></param>
 public override void TriggerEnterAction(GameObject collider)
 {
     if (OnEnter != null && Activable)
     {
         OnEnter.Invoke();
     }
 }
Exemplo n.º 7
0
 public override void Enter()
 {
     if (OnEnter != null)
     {
         OnEnter.Invoke();
     }
 }
Exemplo n.º 8
0
 public void EnterBase(Action <GameState> setState)
 {
     SetState = setState;
     m_GameStore.StoreDidUpdate += StoreDidUpdate;
     Enter();
     OnEnter?.Invoke(this, EventArgs.Empty);
 }
Exemplo n.º 9
0
        internal void Go(string roomIdentifier, bool leave = true)
        {
            if (!ObjectManager <IRoom> .Instance.Get <Room.RoomManager>().Contains(roomIdentifier))
            {
                throw new ArgumentException($"Unknown room: {roomIdentifier}");
            }

            if (leave)
            {
                var allowLeave = GetRoom()?.OnLeave(User);
                if (allowLeave == false)
                {
                    return;
                }
            }

            if (CurrentRoom != null)
            {
                Rooms.Push(CurrentRoom);
            }

            CurrentRoom = new StackedRoom(roomIdentifier);
            User.MessageManager.ShownStats = ShownStats.Default;

            GetRoom()?.OnEnter(User);
            OnEnter?.Invoke(User, roomIdentifier);
        }
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (OnEnter != null)
     {
         OnEnter.Invoke();
     }
 }
Exemplo n.º 11
0
 public Action <IReference, bool> CreateOnEnter(Action <IReference, bool> onEnter)
 {
     return((IReference reference, bool appearing) => {
         onEnter?.Invoke(reference, appearing);
         OnEnter?.Invoke(reference, appearing);
     });
 }
Exemplo n.º 12
0
        /// <summary>
        /// 更新状态
        /// </summary>
        public override void Update()
        {
            Vector2 pos       = Input.MousePositionInConsole;
            Vector2 cursorPos = new Vector2(pos.X / (int)manager.Graphics.CharWidth, pos.Y);

            bool enter = positions.Contains(cursorPos) && Input.MouseInConsole;

            if (enter)
            {
                OnEnter?.Invoke();
                if (Touch)
                {
                    if (Input.GetMouseButton(MouseButton.Left))
                    {
                        OnClick?.Invoke();
                    }
                }
                else
                {
                    if (Input.GetMouseButtonUp(MouseButton.Left))
                    {
                        OnClick?.Invoke();
                    }
                }
            }
            else
            {
                OnLeave?.Invoke();
            }
        }
Exemplo n.º 13
0
 public void Execute(object parameter)
 {
     if (CanExecuteProp)
     {
         OnEnter?.Invoke(this);
     }
 }
Exemplo n.º 14
0
 private void OnTriggerEnter2D(Collider2D obj)
 {
     if (obj.tag == "Ball")
     {
         OnEnter?.Invoke();
     }
 }
Exemplo n.º 15
0
        public virtual void Update(GameTime gameTime)
        {
            MouseState state = Mouse.GetState();

            if (position.Intersects(new Rectangle(state.Position, new Point(15, 15))))
            {
                hovered = true;
                OnMouseEnter?.Invoke(this, EventArgs.Empty);
            }
            else
            {
                if (hovered)
                {
                    OnMouseLeave?.Invoke(this, EventArgs.Empty);
                    hovered = false;
                }
            }

            if (hovered && state.LeftButton == ButtonState.Released && prevState.LeftButton == ButtonState.Pressed)
            {
                OnMouseLeftClicked?.Invoke(this, EventArgs.Empty);
            }
            else if (hovered && state.RightButton == ButtonState.Released && prevState.RightButton == ButtonState.Pressed)
            {
                OnMouseRightClicked?.Invoke(this, EventArgs.Empty);
            }
            else if (isSelected && Keyboard.GetState().IsKeyDown(Keys.Enter))
            {
                OnEnter?.Invoke(this, EventArgs.Empty);
            }

            prevState = state;
        }
 public void OnPointerEnter(PointerEventData eventData)
 {
     if (InputManager.Instance.CurrentInputDevice != InputManager.GameInputDevice.KeyboardAndMouse)
     {
         OnEnter?.Invoke(this);
     }
 }
Exemplo n.º 17
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (!ZoneEnabled)
     {
         return;
     }
     OnEnter?.Invoke(collision.gameObject);
 }
Exemplo n.º 18
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.TryGetComponent(out DrumCharacterBehaviour drummer) || other.TryGetComponent(out GuitaristCharacterBehaviour guitarist))
     {
         IsEntered = true;
         OnEnter?.Invoke();
     }
 }
 // gets ref and sets m_CanExecuteButtons to true
 protected override void ExecuteOnEnter(Collider2D other)
 {
     m_InZone              = true;
     m_InputController     = other.gameObject.GetComponent <InputController>();
     m_InteractingCollider = other;
     OnEnter.Invoke();
     Debug.Log("[" + other.gameObject.name + "] has entered [" + name + "]");
 }
Exemplo n.º 20
0
        public override void Enter()
        {
            base.Enter();

            _stateEnterTime = Time.time;

            OnEnter?.Invoke();
        }
Exemplo n.º 21
0
 public virtual void Enter()
 {
     if (animator != null)
     {
         animator.Play("Enter");
     }
     OnEnter?.Invoke();
 }
Exemplo n.º 22
0
 protected bool Enter(Point location)
 {
     if (state == EHover.OUT)
     {
         state = EHover.ENTER;
         OnEnter?.Invoke(entity, location);
     }
     return(true);
 }
Exemplo n.º 23
0
 public Action <IReference, bool> CreateOnEnter(Action <IReference, bool> onEnter)
 {
     return((IReference reference, bool appearing) =>
     {
         _ = SetPositioningStylesAsync(reference.Current);
         onEnter?.Invoke(reference, appearing);
         OnEnter?.Invoke(reference, appearing);
     });
 }
Exemplo n.º 24
0
    void OnTriggerEnter2D(Collider2D obj)
    {
        if (obj.tag == "Ball")
        {
            OnEnter?.Invoke();

            audioSource.clip = clips[UnityEngine.Random.Range(0, clips.Length)];
            audioSource.Play();
        }
    }
 private void OnTriggerEnter(Collider other)
 {
     if (Interactable.GetInteractable(other.transform) is var i && i != null)
     {
         if (AddToDictionary(i))
         {
             OnEnter?.Invoke(i);
         }
     }
 }
Exemplo n.º 26
0
 private void OnEnteredSubNode(Node node)
 {
     OnEnter?.Invoke(node);
     lastSubNode = (UpgradeSubNode)node;
     if (isActivatingNewLink && activatingSubNode == null)
     {
         lastSubNode.ActivatingLinkStart();
         Element.VisualElement.RemoveFromClassList(ActivatingLinkClass);
     }
 }
Exemplo n.º 27
0
        protected async Task HandleEnterAsync(IReference refback, bool appear)
        {
            var styles = new Dictionary <string, object>
            {
                { "height", $"{CollapsedHeight}px" }
            };

            await DomHelpers.SetStyleAsync(refback.Current, styles, trigger : true);

            OnEnter?.Invoke(refback, appear);
        }
Exemplo n.º 28
0
 public override void Update(GameTime gameTime)
 {
     if (Keys.Enter.IsKeyDown())
     {
         OnEnter?.Invoke();
     }
     if (Keys.Escape.IsKeyDown())
     {
         Unfocus();
     }
 }
Exemplo n.º 29
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (_triggerActivatorsTegs.Contains(collision.tag))
     {
         OnEnter?.Invoke(_args);
         if (_disableAfterEnter)
         {
             Deactivate();
         }
     }
 }
Exemplo n.º 30
0
    protected void Enter(ColliderType collider)
    {
        bool wasActive = Active;

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

        if (!wasActive)
        {
            OnActivate.Invoke(collider);
        }
    }