Beispiel #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);
                }
            }
        }
Beispiel #2
0
        public override bool TriggerEvent(EventType Event, string[] args)
        {
            if (MyEffect.get() == null)
            {
                return(false);
            }
            else
            {
                if (SpecularParameter == null)
                {
                    SpecularParameter = MyEffect.findEffectParameter("Specular");
                    OldSpecular       = SpecularParameter.GetValueSingle();
                }
                if (ColorParameter == null)
                {
                    ColorParameter = MyEffect.findEffectParameter("Color");
                    OldColor       = ColorParameter.GetValueVector4();
                }
            }

            switch (Event)
            {
            case EventType.Kill:
                Dead.set(true);
                if (args.Count() > 0)
                {
                    float f = Logic.ParseF(args[0]);
                    if (f != 0)
                    {
                        ChangeSpeed.set(f);
                    }
                }
                return(true);

            case EventType.Revive:
                Dead.set(false);
                if (args.Count() > 0)
                {
                    float f = Logic.ParseF(args[0]);
                    if (f != 0)
                    {
                        ChangeSpeed.set(f);
                    }
                }
                return(true);
            }

            return(base.TriggerEvent(Event, args));
        }
Beispiel #3
0
        public override bool TriggerEvent(EventType Event, string[] args)
        {
            switch (Event)
            {
            case EventType.SetTime:
                Time = Logic.ParseI(args[0]);
                Triggered.set(true);
                return(true);

            case EventType.ResetTime:
                Time = ResetTime.get();
                Triggered.set(true);
                return(true);
            }

            return(base.TriggerEvent(Event, args));
        }