Ejemplo n.º 1
0
        public override void Update(GameTime gameTime)
        {
            switch (lightState)
            {
            case LightState.Alive:
                RemoveTag(GameObjectTag.Update);
                break;

            case LightState.Dead:
                RemoveTag(GameObjectTag.Update);
                break;

            case LightState.Dying:
                FlickerMult -= ChangeSpeed.get() * gameTime.ElapsedGameTime.Milliseconds;
                if (FlickerMult < 0)
                {
                    lightState = LightState.Dead;
                    RemoveTag(GameObjectTag.Update);
                }
                break;

            case LightState.Reviving:
                FlickerMult += ChangeSpeed.get() * gameTime.ElapsedGameTime.Milliseconds;
                if (FlickerMult > 1)
                {
                    lightState = LightState.Alive;
                    RemoveTag(GameObjectTag.Update);
                }
                break;
            }

            base.Update(gameTime);
        }
        private void ShadowChange()
        {
            if (UseShadows.get())
            {
                if (MyEffect.get() == null || MyEffect.getPath().Equals("Deferred/PointLightNoShadows"))
                {
                    MyEffect.set("Deferred/PointLightShadows");
                }

                ShadowCube = AssetManager.RequestCubeMap((int)ShadowMapSize.get(), SurfaceFormat.HalfSingle, DepthFormat.Depth24Stencil8, ShadowCube);
                if (MyEffect.Holder != null)
                {
                    DeferredLightEffect effect3D = (DeferredLightEffect)(MyEffect.Holder);
                    if (ShadowCube.Value != null)
                    {
                        effect3D.ShadowReference.SetValue(ShadowCube.Value);
                    }
                }

                DrawShadows();
            }
            else
            {
                if (MyEffect.get() == null || MyEffect.getPath().Equals("Effects/Deferred/PointLightShadows"))
                {
                    MyEffect.set("Deferred/PointLightNoShadows");
                }
                AssetManager.FreeRenderTarget(ShadowCube);
            }
        }
 void TextChange()
 {
     if (Size != null && Font.get() != null)
     {
         Size.set(Font.get().MeasureString(Text.get()) * SizeMult.get());
     }
 }
 public override void CreateInGame()
 {
     for (int i = 0; i < FlareCount.get(); i++)
     {
         ParentLevel.AddObject(new WorldFlare(Distance.get(), SpawnPosition.get(), Color.getAsColor(), Speed.get()));
     }
     base.CreateInGame();
 }
        public override void Update(GameTime gameTime)
        {
            WorldCameraInterpolation += gameTime.ElapsedGameTime.Milliseconds * 60 / 100000f * CameraSpeed.get();

            if (WorldCameraInterpolation > 1)
            {
                WorldCameraInterpolation = 0;
                WorldCameraFrom          = Rand.V3() * CameraDistance.get();
                WorldCameraTo            = Rand.V3() * CameraDistance.get();
            }

            //WorldCameraLookAt = MyPoint.DrawPosition;
            MyCamera.SetLookAt(Vector3.Lerp(WorldCameraFrom, WorldCameraTo, WorldCameraInterpolation), WorldCameraLookAt);
            //MyCamera.SetLookAt(new Vector3(10,100,10), new Vector3(0,0,0));
            MyPoint.Update(gameTime);

            base.Update(gameTime);
        }
        void RetireActiveParticles()
        {

            while (firstActiveParticle != firstNewParticle)
            {
                float particleAge = Level.Time - particles[firstActiveParticle * 4].Time;

                if (particleAge < ParticleDuration.get())
                    break;

                particles[firstActiveParticle * 4].Time = drawCounter;

                // MoveControl the particle from the active to the retired queue.
                firstActiveParticle++;

                if (firstActiveParticle >= (int)MaxParticles.get())
                    firstActiveParticle = 0;
            }
        }
Ejemplo n.º 7
0
        public override bool TriggerEvent(EventType Event, string[] args)
        {
            switch (Event)
            {
            case EventType.AddObject:
                GameObject o = ParentLevel.FindObject(args[0]);
                if (o != null && o.GetType().IsSubclassOf(typeof(Basic3DObject)))
                {
                    Basic3DObject b = (Basic3DObject)o;

                    if (ObjectCount == 0)
                    {
                        AddTag(GameObjectTag.Update);
                    }

                    if (arySize == ObjectCount)
                    {
                        if (arySize == 0)
                        {
                            PathObjects  = new GameObject[4];
                            PathSpeed    = new float[4];
                            PathPosition = new float[4];
                        }
                        else
                        {
                            arySize *= 2;
                            GameObject[] NewPathObjects  = new GameObject[arySize];
                            float[]      NewPathSpeed    = new float[arySize];
                            float[]      NewPathPosition = new float[arySize];

                            for (int i = 0; i < ObjectCount; i++)
                            {
                                NewPathObjects[i]  = PathObjects[i];
                                NewPathSpeed[i]    = PathSpeed[i];
                                NewPathPosition[i] = PathPosition[i];
                            }

                            PathObjects  = NewPathObjects;
                            PathPosition = NewPathPosition;
                            NewPathSpeed = PathSpeed;
                        }
                    }

                    PathObjects[ObjectCount]  = b;
                    PathPosition[ObjectCount] = Logic.ParseF(args[1]);
                    float f = Logic.ParseF(args[2]);
                    PathSpeed[ObjectCount] = f != 0 ? f : TravelSpeed.get();
                    ObjectCount++;
                }
                return(true);
            }

            return(base.TriggerEvent(Event, args));
        }
        public override void Update(GameTime gameTime)
        {
            if (Visible.get())
            {
                SizeMult += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * SizeChange.get();
                if (SizeMult > 1)
                {
                    SizeMult = 1;
                }
            }
            else
            {
                SizeMult -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * SizeChange.get();
                if (SizeMult < 0)
                {
                    SizeMult = 0;
                }
            }

            base.Update(gameTime);
        }
Ejemplo n.º 9
0
        public override bool MarkerMove(Vector2 MoveAmount)
        {
            if (SliderValue != null && Math.Abs(MoveAmount.X) > 0.1f)
            {
                if (BasicMarker.MoveSound != null)
                {
                    BasicMarker.MoveSound.Play(BasicMarker.MoveVolume, 0, 0);
                }

                if (ChangeTime > MaxChangeTime)
                {
                    ChangeTime = 0;
                    SliderValue.add(ChangeAmount.get() * (MoveAmount.X > 0 ? 1 : -1));
                    if (SliderValue.get() > MaxValue.get())
                    {
                        SliderValue.set(MaxValue.get());
                    }
                    else if (SliderValue.get() < MinValue.get())
                    {
                        SliderValue.set(MinValue.get());
                    }
                }

                if (MoveAmount.X > 0)
                {
                    Arrow1.FlashAlpha = 1;
                }
                else
                {
                    Arrow2.FlashAlpha = 1;
                }

                return(false);
            }

            return(true);
        }
 private void EnergyCostMultChange()
 {
     EnergyCostMult = energyCostMult.get();
 }
Ejemplo n.º 11
0
        private void PathChange()
        {
            RenderTargetCube tc = new RenderTargetCube(Game1.graphicsDevice, Math.Max(64, (int)Resolution.get()), false, SurfaceFormat.Color, DepthFormat.None);

            {
                for (int i = 0; i < 6; i++)
                {
                    CubeMapFace face = (CubeMapFace)i;
                    SkyFaceTexture = AssetManager.Load <Texture2D>(this.GetParent().TextureDirectory.get() +
                                                                   Path.get() + face.ToString().Substring(0, 3).ToLower() +
                                                                   face.ToString().Last().ToString().ToUpper());
                    Game1.graphicsDevice.SetRenderTarget(tc, face);
                    Game1.graphicsDevice.Clear(Color.Black);
                    Game1.graphicsDevice.Textures[0] = SkyFaceTexture;
                    Deferred3DScene.PasteEffect.CurrentTechnique.Passes[0].Apply();
                    FullscreenQuad.Draw();
                }
            }

            Game1.graphicsDevice.SetRenderTarget(null);
            Game1.graphicsDevice.Clear(Color.Transparent);
            if (MyCube.get() != null)
            {
                MyCube.get().Dispose();
            }
            MyCube.set(tc);
        }
 public override void ChangeScale()
 {
     ScaleMatrix = Matrix.CreateScale(ZoomDistance.get() / 25);
     ChangeLookAt();
     UpdateWorldMatrix();
 }
        public override void Update(GameTime gameTime)
        {
            ItemTime += gameTime.ElapsedGameTime.Milliseconds;
            if (ItemTime > MaxItemTime.get())
            {
                ItemTime -= MaxItemTime.get();

                CurrentItem++;
                if (CurrentItem > ModelCount.get() - 1)
                {
                    CurrentItem = 0;
                }
            }
            if (Items[CurrentItem] == null)
            {
                Items[CurrentItem] = new LineModelItem(Models[CurrentItem].get(), LineFlares.get(), RandomFlares.get());
            }
            Items[CurrentItem].Update(gameTime);

            WorldCameraInterpolation += gameTime.ElapsedGameTime.Milliseconds * 60 / 100000f * CameraSpeed.get();

            if (WorldCameraInterpolation > 1)
            {
                WorldCameraInterpolation = 0;
                WorldCameraFrom          = Rand.V3() * Items[CurrentItem].Distance * 3;
                WorldCameraTo            = Rand.V3() * Items[CurrentItem].Distance * 3;
                WorldCameraLookAt        = Items[CurrentItem].Points[Rand.r.Next(Items[CurrentItem].Points.Count)] / 2;
            }

            MyCamera.SetLookAt(Vector3.Lerp(WorldCameraFrom, WorldCameraTo, WorldCameraInterpolation), WorldCameraLookAt);

            base.Update(gameTime);
        }
Ejemplo n.º 14
0
        public override void Update(GameTime gameTime)
        {
            if (FrameLess)
            {
                DrawPosition = Position.get();
                DrawSize     = Size.get();
            }
            else if (ParentFrame != null)
            {
                Vector2 ProjectedSize = Size.get() * ParentFrame.FrameSize / ParentFrame.CameraZoom;
                DrawPosition = (Position.get() - ParentFrame.CameraPosition + ParentFrame.ScreenOffset) / ParentFrame.FrameSize * ParentFrame.CameraZoom + Render.CurrentView.Size / 2;
                DrawSize     = Vector2.Normalize(Size.get()) * ProjectedSize.Length();
            }

            if (FormChildren != null)
            {
                Alpha += gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange;
                if (Alpha > 1)
                {
                    Alpha = 1;
                }

                if (CurrentForm != null)
                {
                    float MoveAmount   = gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * MoveSpeed.get();
                    float ReSizeAmount = gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * ResizeSpeed.get();

                    if (Vector2.Distance(Position.get(), CurrentForm.Position.get()) < MoveAmount)
                    {
                        Position.set(CurrentForm.Position.get());
                    }
                    else
                    {
                        Position.add(Vector2.Normalize(CurrentForm.Position.get() - Position.get()) * MoveAmount);
                    }

                    if (Vector2.Distance(Size.get(), CurrentForm.Size.get()) < ReSizeAmount)
                    {
                        Size.set(CurrentForm.Size.get());
                    }
                    else
                    {
                        Size.add(Vector2.Normalize(CurrentForm.Size.get() - Size.get()) * ReSizeAmount);
                    }
                }
            }
            else
            {
                Alpha -= gameTime.ElapsedGameTime.Milliseconds * 60 / 1000f * AlphaChange;
                if (Alpha < 0)
                {
                    Alpha = 0;
                }
            }

            base.Update(gameTime);
        }
Ejemplo n.º 15
0
 void BrightnessChange()
 {
     BloomRenderer.SetIntensity(BrightnessValue.get());
 }
Ejemplo n.º 16
0
 public void ProduceParticle(Vector3 Position)
 {
     if (CanProduceParticles)
     {
         ParticleManager.CreateParticle(Position, Logic.RLerp(MinVelocity.get(), MaxVelocity.get()), new Color(Logic.RLerp(MinColor.get(), MaxColor.get())), MathHelper.Lerp(MinSize.get(), MaxSize.get(), Rand.F()), ParticleType.get());
     }
 }
 private void CellsCostMustChange()
 {
     CellsCostMult = cellsCostMult.get();
 }
 private void StartingTurretDistanceChange()
 {
     StartingTurretDistance = startingTurretDistance.get();
 }
Ejemplo n.º 19
0
 void ContrastChange()
 {
     BloomRenderer.SetSaturation(ContrastValue.get());
 }