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); }
public override void CreateInGame() { if (PatternSource.get().Equals("")) { MyPattern = new WavePattern(CardCount.get()); } else { MyPattern = new WavePattern(CardCount.get(), PatternSource.get()); } base.CreateInGame(); }
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 void CreateInGame() { PlasmaTurret p = new PlasmaTurret(FactionNumber.get()); ParentLevel.AddObject(p); p.SetPosition(Position.get()); base.CreateInGame(); }
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 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)); }
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); }
private void TimeChange() { for (int i = 0; i < EventCount.get(); i++) { if (Times[i].get() > MaxTime) { MaxTime = Times[i].get(); } } }
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)); }
public void AddTime(GameTime gameTime) { Timer += gameTime.ElapsedGameTime.Milliseconds; if (Timer > GameDelay.get()) { Timer = 0; CanProduceParticles = true; } else { CanProduceParticles = false; } }
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); }
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 }
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); } } } } }
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()); }
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); }
private void TurretLivesCountChange() { TurretLivesCount = turretLivesCount.get(); }
private void PlayerRespawnTimeChange() { PlayerRespawnTime = playerRespawnTime.get(); }
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()); } }