public override void Update(SceneGraph graph) { base.Update(graph); ticks = ticks % 120; if (ticks == 0) { Velocity = RNG.RandomUnitVector(); } ticks++; }
public override void Update(SceneGraph graph) { }
public override void Update(SceneGraph graph) { base.Update(graph); if (State == CellState.Dead) { if (DeathCounter > 0) { DeathCounter--; Tint = new Color(Tint.R, Tint.G, Tint.B, DeathCounter); } else { graph.Remove(this); } } }
public virtual void Update(SceneGraph graph) { if (Velocity != Vector2.Zero) { Vector2 newPosition = Position; newPosition.X += Velocity.X * Speed; newPosition.Y += Velocity.Y * Speed; Position = newPosition; } if (IsAnimating && Animation != null) { Animation.Update(); DrawBounds = Animation.CurrentFrameRect; //DrawSize = _Animations[CurrentAnimation].CurrentFrameRect; } }
private void BirthChild(SceneGraph graph) { if (Energy >= GameStats.ChildEnergyCost) { if (!birthSoundPlayed) { SoundManager.PlaySound(GameAssets.BirthSound, Position, 1F); birthSoundPlayed = true; } Virus childVirus = Virus.Build(); childVirus.VirusMode = Mode.Infecting; childVirus.InfectedCell = this.InfectedCell; Vector2 childPosition = InfectedCell.Position; Vector2 offset = GetRandomOffsetWithinBounds(InfectedCell.DrawBounds); childVirus.Position = InfectedCell.Position + offset; graph.Add(childVirus); Energy = 0; } }
public override void Update(SceneGraph graph) { birthSoundPlayed = false; this.Speed = GameStats.VirusSpeed; base.Update(graph); if (VirusMode == Mode.Free) { if (Velocity != Vector2.Zero) { Rotate(); if (IsPlayer) { ApplyFriction(); } } } else if (VirusMode == Mode.Infecting) { ticks++; if (ticks % 100 == 0) { ticks = 0; DrainEnergy(); BirthChild(graph); Scatter(); } } else if (VirusMode == Mode.Dead) { if (DeathCounter > 0) { DeathCounter--; Tint = new Color(Tint.R, Tint.G, Tint.B, DeathCounter); } else { graph.Remove(this); } } if (IsImmune) { ImmunityTicks++; if (ImmunityTicks >= ImmunityCounter) { IsImmune = false; this.Tint = Color.White; } else { this.Tint = Color.Red; } } }
public void Initialize() { SceneGraph = new SceneGraph(Map, Camera); DebugHud = new DebugHud(new Vector2(16, 16), GameAssets.FontArial, Color.Black, Color.Black, Color.Black); EvoModal = EvolutionModal.Build(); SeedLevel(Map); SoundManager.PlayMusic(); }