예제 #1
0
        private void TestTrigger(GameTime gameTime)
        {
            if (Used.get() && !AllowReset.get())
            {
                return;
            }
            if (TriggeringObject.get() != null && TestCollision((Basic3DObject)TriggeringObject.get()))
            {
                if (!Used.get())
                {
                    MyEvent.Trigger();
                    Used.set(true);
                }
                return;
            }

            if (Used.get())
            {
                ResetTime += gameTime.ElapsedGameTime.Milliseconds;
                if (ResetTime > ResetDelay.get())
                {
                    ResetTime = 0;
                    Used.set(false);
                }
            }
        }
        public override bool TriggerAsCurrent(BasicMarker m)
        {
            LastMarker = m;
            if (ButtonEvent.get().Equals(""))
            {
                if (Event == null && TargetMenu == null)
                {
                    ErrorAlpha = 1;
                    return(false);
                }

                if (Event != null)
                {
                    bool Result = Event(this, m);

                    if (BasicMarker.SelectSound != null)
                    {
                        BasicMarker.SelectSound.Play(BasicMarker.SelectVolume, 0, 0);
                    }

                    if (Result)
                    {
                        FlashAlpha = 1;
                        return(true);
                    }
                    else
                    {
                        ErrorAlpha = 1;
                        return(false);
                    }
                }
                else if (ParentFrame != null)
                {
                    if (TargetMenu.Equals(""))
                    {
                        ParentFrame.DeActivate();
                    }
                    else
                    {
                        ParentFrame.Cycle(TargetMenu);
                    }

                    FlashAlpha = 1;
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            else
            {
                ButtonEvent.Trigger();
                return(true);
            }
        }