コード例 #1
0
        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);
        }
コード例 #2
0
        public override void CreateInGame()
        {
            if (PatternSource.get().Equals(""))
            {
                MyPattern = new WavePattern(CardCount.get());
            }
            else
            {
                MyPattern = new WavePattern(CardCount.get(), PatternSource.get());
            }

            base.CreateInGame();
        }
コード例 #3
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);
                }
            }
        }
コード例 #4
0
        public override void CreateInGame()
        {
            PlasmaTurret p = new PlasmaTurret(FactionNumber.get());

            ParentLevel.AddObject(p);
            p.SetPosition(Position.get());
            base.CreateInGame();
        }
コード例 #5
0
 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();
 }
コード例 #6
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));
        }
コード例 #7
0
 public override void Update(GameTime gameTime)
 {
     Timer += gameTime.ElapsedGameTime.Milliseconds;
     if (Timer > CinematicDelay.get())
     {
         Timer -= CinematicDelay.get();
         if (!NoInterpolate.get())
         {
             ParticleManager.CreateParticle(Position.get(), Logic.RLerp(MinVelocity.get(), MaxVelocity.get()), new Color(Logic.RLerp(MinColor.get(), MaxColor.get()) / 3), MathHelper.Lerp(MinSize.get(), MaxSize.get(), Rand.F()), ParticleType.get());
         }
         else
         {
             ParticleManager.CreateParticle(Position.get(), Logic.RLerp(MinVelocity.get(), MaxVelocity.get()), new Color(MinColor.get() / 3), MathHelper.Lerp(MinSize.get(), MaxSize.get(), Rand.F()), ParticleType.get());
         }
     }
     base.Update(gameTime);
 }
コード例 #8
0
 private void TimeChange()
 {
     for (int i = 0; i < EventCount.get(); i++)
     {
         if (Times[i].get() > MaxTime)
         {
             MaxTime = Times[i].get();
         }
     }
 }
コード例 #9
0
        public override bool TriggerEvent(EventType Event, string[] args)
        {
            switch (Event)
            {
            case EventType.Add:
                if (args.Count() > 0)
                {
                    Count.add(Logic.ParseI(args[0]));
                }
                else
                {
                    Count.add(1);
                }
                return(true);

            case EventType.AddFrom:
                if (args.Count() > 1 && Logic.ParseI(args[0]) == Count.get())
                {
                    Count.set(Logic.ParseI(args[1]));
                }
                return(true);

            case EventType.AddFromAlt:
                if (args.Count() > 2)
                {
                    if (Logic.ParseI(args[0]) == Count.get())
                    {
                        Count.set(Logic.ParseI(args[1]));
                    }
                    else
                    {
                        Count.set(Logic.ParseI(args[2]));
                    }
                }
                return(true);
            }
            return(base.TriggerEvent(Event, args));
        }
コード例 #10
0
        public void AddTime(GameTime gameTime)
        {
            Timer += gameTime.ElapsedGameTime.Milliseconds;

            if (Timer > GameDelay.get())
            {
                Timer = 0;
                CanProduceParticles = true;
            }
            else
            {
                CanProduceParticles = false;
            }
        }
コード例 #11
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            if (FadeColor.A() > 0)
            {
                switch (FadeType.get())
                {
                default:
                    Game1.graphicsDevice.BlendState = BlendState.AlphaBlend;
                    BasicFadeEffect.CurrentTechnique.Passes[0].Apply();
                    BasicFadeColorParam.SetValue(FadeColor.get());

                    break;
                }

                FullscreenQuad.Draw();
            }

            base.Draw2D(DrawTag);
        }
コード例 #12
0
        private void CountChange()
        {
            EventValue[] NewEvents     = new EventValue[EventCount.get()];
            IntValue[]   NewThresholds = new IntValue[EventCount.get()];

            for (int i = 0; i < Math.Max(EventCount.get(), EventCountPrevious); i++)
            {
                if (i < EventCount.get())
                {
                    if (i < EventCountPrevious)
                    {
                        NewEvents[i]     = Events[i];
                        NewThresholds[i] = Thresholds[i];
                    }
                    else
                    {
                        Level.ReferenceObject = this;
                        NewThresholds[i]      = new IntValue("Threshold " + i.ToString(), i * 1000);
                        NewEvents[i]          = new EventValue("Event " + i.ToString());
                    }
                }
                else
                {
                    RemoveValue(Thresholds[i]);
                    RemoveValue(Events[i]);
                }
            }

            Events     = NewEvents;
            Thresholds = NewThresholds;

            EventCountPrevious = EventCount.get();
#if EDITOR && WINDOWS
            if (ParentLevel.LevelForEditing)
            {
                ParentScene.UpdateSelected();
            }
#endif
        }
コード例 #13
0
        public override void Draw2D(GameObjectTag DrawTag)
        {
            return;

            if (Drawing)
            {
                for (int x = 0; x < CellsX.get(); x++)
                {
                    for (int y = 0; y < CellsY.get(); y++)
                    {
                        if (CellAlpha[x, y] > 0)
                        {
                            Vector2 TransformedPosition = new Vector2(x, y) * Divisor + Parent2DScene.MinBoundary.get();

                            Vector3 Position3 = Game1.graphicsDevice.Viewport.Project(
                                new Vector3(TransformedPosition.X, 0, TransformedPosition.Y), StarshipScene.CurrentCamera.ProjectionMatrix,
                                StarshipScene.CurrentCamera.ViewMatrix, Matrix.Identity);

                            Vector2 Position = new Vector2(Position3.X, Position3.Y) - Render.CurrentView.Position;
                            float   Size     = 6;

                            Render.DrawSolidRect(Position - new Vector2(Size), Position + new Vector2(Size),
                                                 Color.White * CellAlpha[x, y]);

                            base.Draw2D(DrawTag);
                        }
                    }
                }
            }
        }
コード例 #14
0
        public override void Create()
        {
            CellsX    = new IntValue("CellsX", 100);
            CellsY    = new IntValue("CellsY", 100);
            CellGrid  = new int[100, 100];
            CellAlpha = new float[100, 100];

            CellsX.ChangeEvent = CellsChange;
            CellsY.ChangeEvent = CellsChange;

            AddTag(GameObjectTag.Update);
            AddTag(GameObjectTag._2DOverDraw);

            base.Create();

            Parent2DScene = (Basic2DScene)ParentScene;
            Divisor       = (Parent2DScene.MaxBoundary.get() - Parent2DScene.MinBoundary.get()) / new Vector2(CellsX.get(), CellsY.get());
        }
コード例 #15
0
        private void CreateArray()
        {
            particles = new ParticleVertex[MaxParticles.get() * 4];

            for (int i = 0; i < MaxParticles.get(); i++)
            {
                particles[i * 4 + 0].Corner = new Short2(-1, -1);
                particles[i * 4 + 1].Corner = new Short2(1, -1);
                particles[i * 4 + 2].Corner = new Short2(1, 1);
                particles[i * 4 + 3].Corner = new Short2(-1, 1);
            }

            vertexBuffer = new DynamicVertexBuffer(Game1.graphicsDevice, ParticleVertex.VertexDeclaration,
                                                   MaxParticles.get() * 4, BufferUsage.WriteOnly);

            ushort[] indices = new ushort[MaxParticles.get() * 6];

            for (int i = 0; i < MaxParticles.get(); i++)
            {
                indices[i * 6 + 0] = (ushort)(i * 4 + 0);
                indices[i * 6 + 1] = (ushort)(i * 4 + 1);
                indices[i * 6 + 2] = (ushort)(i * 4 + 2);

                indices[i * 6 + 3] = (ushort)(i * 4 + 0);
                indices[i * 6 + 4] = (ushort)(i * 4 + 2);
                indices[i * 6 + 5] = (ushort)(i * 4 + 3);
            }

            indexBuffer = new IndexBuffer(Game1.graphicsDevice, typeof(ushort), indices.Length, BufferUsage.WriteOnly);

            indexBuffer.SetData(indices);
        }
コード例 #16
0
 private void TurretLivesCountChange()
 {
     TurretLivesCount = turretLivesCount.get();
 }
コード例 #17
0
 private void PlayerRespawnTimeChange()
 {
     PlayerRespawnTime = playerRespawnTime.get();
 }
コード例 #18
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());
     }
 }