public WaveSpawner() { m_EntityCount = 4; //To Change m_TimeCounter = 0; m_VerticalRandomSeed = new Random(); m_TimeRandomSeed = new Random(); m_HasWaveStarted = false; m_HasWaveStopped = false; m_ScreenResolution = GraphicsManager.Instance.ScreenResolution; m_EntityPosition = new Vector2(m_ScreenResolution.X + 50.0f, 0.0f); m_StopWatch = new GameStopWatch(); m_TimeSpan = new GameTimeSpan(); m_TimeSpan.Seconds = 10.0f; m_StopWatch.SetTimeInterval(m_TimeSpan); //for (int m_IndexA = 0; m_IndexA < m_EntityCount; m_IndexA++) //{ // m_EntityPosition.Y = m_VerticalRandomSeed.Next(0, (int)m_ScreenResolution.Y); // EntityManager.Instance.AddGameEntity(new Zombie()); // EntityManager.Instance.DrawableGameObjects[EntityManager.Instance.DrawableGameObjects.Count - 1].Initialize(GraphicsManager.Instance); // EntityManager.Instance.DrawableGameObjects[EntityManager.Instance.DrawableGameObjects.Count - 1].Sprite.Position = m_EntityPosition; //} base.Sprite = new Sprite(); base.Sprite.Texture = ContentLoader.Instance.Load<Texture2D>(ContentContainer.Game, @"Content\\House"); }
public override void Initialize(GraphicsManager graphics) { if (Sprite.Texture == null) { Sprite.Texture = ContentLoader.Instance.Load<Texture2D>(ContentContainer.Game, @"Content\\Zombie"); base.Sprite.Rotation = MathHelper.Pi * 1.5f; base.Sprite.CenterImage(); } m_MyLogic = new EntityAI(base.Sprite.Position, 200.0f, 3.0f); m_PossiblePosition = base.Sprite.Position; m_PreviousPosition = new Vector2(); m_StartMoving = true; base.Initialize(graphics); m_AudioWalk = new AudioEffect(); m_AudioWalk.LoadAudioEffect(@"Content\\Sounds\\zombie2", ContentContainer.Game); m_AudioWalk.Volume = 0.3f; m_AudioWalk.Pan = -1.0f; m_StopWatch = new GameStopWatch(); GameTimeSpan timeSpan = new GameTimeSpan(); timeSpan.Seconds = 2f; m_StopWatch.SetTimeInterval(timeSpan); m_CurrentHealth = 100; m_MaxHealth = 100; }
public void SetTimeInterval(GameTimeSpan gameTimeSpan) { if (gameTimeSpan.Days > 0) { m_TargetTime += gameTimeSpan.Days * 86400000f; } if (gameTimeSpan.Hours > 0) { m_TargetTime += gameTimeSpan.Hours * 3600000; } if (gameTimeSpan.Minutes > 0) { m_TargetTime += gameTimeSpan.Minutes * 60000; } if (gameTimeSpan.Seconds > 0) { m_TargetTime += gameTimeSpan.Seconds * 1000; } if (gameTimeSpan.Milliseconds > 0) { m_TargetTime += gameTimeSpan.Milliseconds; } }
protected GameTimer() { m_ElapsedFrameTime = new GameTimeSpan(); }