Example #1
0
        private void OnUngrab(ActionChange uEv)
        {
            var delta = Time.time - lastGrabPressTime;
            var isUnderGrabToggleTiming = delta < toggleGrabPressTiming;

            foreach (IGrabable grabable in grabbing)
            {
                // If we are toggle grabbing the object we should also remove it from the list
                if (toggleGrabbing.Contains(grabable))
                {
                    toggleGrabbing.Remove(grabable);
                    grabable.Ungrabbed(this);
                }
                // if this might be a grab toggle and the surface allows it,
                // add it to the toggle-grabbing list. otherwise, whether it's
                // not a grab toggle or the surface won't be toggle-grabbed,
                // ungrab the surface
                else if (uEv.action == OutputAction.GrabToggle && isUnderGrabToggleTiming && grabable.GetGrabMode().HasFlag(GrabMode.ToggleGrabable))
                {
                    toggleGrabbing.Add(grabable);
                }
                else
                {
                    grabable.Ungrabbed(this);
                }
            }

            grabbing.Clear();
            foreach (var grabable in toggleGrabbing)
            {
                grabbing.Add(grabable);
            }
        }
Example #2
0
        private ActionChangeUnpressHandler OnInteractUI(ActionChange pEv)
        {
            if (!IsSameHand(trackedHand.hand, pEv.hand))
            {
                return (uEv) => { }
            }
            ;

            foreach (IActivateable button in intersectingActivatables)
            {
                var unpress = button.Activate(this);

                pressedActivatableReleases.Add(button, unpress);
            }

            return((uEv) =>
            {
                foreach (var pressedActivatable in pressedActivatableReleases)
                {
                    var unpress = pressedActivatable.Value;
                    unpress();
                }

                pressedActivatableReleases.Clear();
            });
        }
        protected ActionChangeUnpressHandler OnBack(ActionChange pEv)
        {
            float menuPressTime = Time.time;

            return((uEv) =>
            {
                if (Time.time - menuPressTime < menuButtonReleaseTimeout)
                {
                    Back();
                }
            });
        }
Example #4
0
        private ActionChangeUnpressHandler OnAction(ActionChange pEv)
        {
            if (IsValidHand(pEv.hand) && joyBtnMap.ContainsKey(pEv.action))
            {
                uint btnIndex = joyBtnMap[pEv.action];
                PressButton(btnIndex);

                return((uEv) => { UnpressButton(btnIndex); });
            }

            return((uEv) => { });
        }
Example #5
0
 public void ActionResult(ActionChange result)
 {
     Healts += result.HealthChange;
     Power  += result.PowerChange;
     Money  += result.MoneyChange;
     _output.Print(ToString());
     if (Healts <= 0)
     {
         _output.Print("Game over.");
         _output.Print("Initial new game.");
         Initial();
     }
 }
Example #6
0
        private PressManager.UnpressHandlerDelegate <ActionChange> OnGrab(ActionChange pEv)
        {
            if (!IsSameHand(trackedHand.hand, pEv.hand))
            {
                return (uEv) => { }
            }
            ;

            foreach (IGrabable grabable in intersectingGrababales)
            {
                var canGrab = !grabbing.Contains(grabable) &&
                              grabable.GetGrabMode().HasFlag(GrabMode.Grabable);

                if (canGrab && grabable.Grabbed(this))
                {
                    grabbing.Add(grabable);
                }
            }

            lastGrabPressTime = Time.time;

            return(OnUngrab);
        }
Example #7
0
        protected ActionChangeUnpressHandler OnTargetCurrentSignal(ActionChange pEv)
        {
            var unpress = CallbackPress(EDControlBindings.GetControlButton(EDControlButton.ExplorationFSSTarget));

            return((uEv) => unpress());
        }
Example #8
0
        protected ActionChangeUnpressHandler OnExit(ActionChange pEv)
        {
            var unpress = CallbackPress(EDControlBindings.GetControlButton(EDControlButton.ExplorationFSSQuit));

            return((uEv) => unpress());
        }
        protected ActionChangeUnpressHandler OnNestedToggle(ActionChange pEv)
        {
            var unpress = CallbackPress(EDControlBindings.GetControlButton(EDControlButton.UI_Toggle));

            return((uEv) => unpress());
        }
        protected ActionChangeUnpressHandler OnTabNext(ActionChange pEv)
        {
            var unpress = CallbackPress(EDControlBindings.GetControlButton(EDControlButton.CycleNextPanel));

            return((uEv) => unpress());
        }
 public static bool ActionChangeComparator(ActionChange pEv, ActionChange uEv)
 {
     return(uEv.hand == pEv.hand && uEv.action == pEv.action);
 }
        protected ActionChangeUnpressHandler OnSelect(ActionChange pEv)
        {
            var unpress = Select();

            return((uEv) => unpress());
        }
Example #13
0
 private PressManager.UnpressHandlerDelegate <ActionChange> OnResetSeatedPosition(ActionChange pEv)
 {
     StartCoroutine(HoldingMenuButtons());
     return((uEv) => StopAllCoroutines());
 }