public override void CollideWithUnit(Player Unit) { Point unitCollisionPoint = new Point(Unit.HitBox().Left + Unit.HitBox().Width/2, Unit.HitBox().Top + Unit.HitBox().Height/2); if(HitBox().Contains(unitCollisionPoint) && KeyMouseReader.KeyClick(Keys.Space)) Unit.ResetPosition(); }
public void Update(Player player, float elapsedTime) { for (int i = 0; i < projectiles.Count; i++) { if(projectiles[i].Active) projectiles[i].Update(player, elapsedTime); } }
public override void CollideWithUnit(Player Unit) { Point unitCollisionPointLeft = new Point(Unit.HitBox().Left + 15, Unit.HitBox().Top + Unit.HitBox().Height - 2); Point unitCollisionPointRight = new Point(Unit.HitBox().Right - 15, Unit.HitBox().Top + Unit.HitBox().Height - 2); if(HitBox().Contains(unitCollisionPointLeft) && HitBox().Contains(unitCollisionPointRight)) Unit.Jump(1.5f); base.CollideWithUnit(Unit); }
public static void Update(Player player, float elapsedTime) { for (int i = 0; i < enemyList.Count; i++) { enemyList[i].Update(elapsedTime, player); if (enemyList[i].HitBox().Intersects(player.HitBox())) enemyList[i].CollideWithPlayer(player); enemyList[i].SpecialAbility(player); } }
public void Update(Player player, float elapsedTime) { timeLived += elapsedTime; position.X += direction.X * speed; position.Y += direction.Y * speed; if (timeLived >= lifeTime) active = false; if (HitBox().Intersects(player.HitBox())) if (AccuratePlayerHitCheck(player.HitBox())) active = false; }
public override void Update(float elapsedTime, Player player) { lastShot += elapsedTime; if (lastShot >= fireRate) { canShoot = true; lastShot = fireRate; } projectileManager.Update(player, elapsedTime); base.Update(elapsedTime, player); }
public override void CollideWithUnit(Player Unit) { Unit.gotKilled = true; }
public virtual void CollideWithUnit(Player Unit) { }
public override void CollideWithUnit(Player Unit) { Unit.foundGoal = true; }
public virtual void CollideWithUnit(Player Unit, float ElapsedTime) { }
public void Initialize() { LightRenderer = new LightRenderer(Game1.graphics); EnemyManager.Reset(); Camera.ClearFocusList(); if (mapManager == null) mapManager = new MapManager(); mapManager.Initialize(LightRenderer); finalRenderTarget = new RenderTarget2D(ScreenManager.Game.GraphicsDevice, MapManager.MapWidth, MapManager.MapHeight); if (Player == null) Player = new Player(); Player.SetStartPos(mapManager.PlayerStartPos); lightPos = mapManager.PlayerStartPos; Camera.ResetValues(mapManager.PlayerStartPos); Camera.DefaultFocus = Player; Camera.Position = mapManager.PlayerStartPos; Camera.Limits = new Rectangle(0, 0, MapManager.MapWidth, MapManager.MapHeight); pointLightHandles = new List<PointLight>(); spotLightHandles = new List<SpotLight>(); LightRenderer.Initialize(0, 0, MapManager.MapWidth, MapManager.MapHeight); LightRenderer.minLight = 0.15f; LightRenderer.lightBias = 10f; spotLightDir = Vector2.UnitX * -1.00001f; //pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 300f, Color.White)); pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 200f, Color.Red)); pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 250f, Color.LightGreen)); pointLightHandles.Add(new PointLight(new Vector2(200, 200), 1f, 250f, Color.LightGreen)); spotLightHandles.Add(new SpotLight(new Vector2(200, 200), spotLightDir, 1f, 2f, 0.5f, 500f, Color.LightBlue)); spotLightHandles.Add(new SpotLight(new Vector2(200, 200), spotLightDir, 1f, 2f, 0.5f, 500f, Color.Red)); //LightRenderer.pointLights.Add(pointLightHandles[0]); //LightRenderer.pointLights.Add(pointLightHandles[1]); //LightRenderer.pointLights.Add(pointLightHandles[2]); //LightRenderer.spotLights.Add(spotLightHandles[0]); //LightRenderer.spotLights.Add(spotLightHandles[1]); LightRenderer.LoadContent(ScreenManager.Game.Content); Console.WriteLine("PointLights.Count: " + LightRenderer.pointLights.Count); myAffectLightDir = false; myCurrLight = 0; }
public virtual void Update(float elapsedTime, Player player) { List<Rectangle> CollisionList = MapManager.GenerateCollisionList((int)position.X, (int)position.Y, colRange, colRange); CheckIfOnGround(CollisionList); position.X += velocity.X; HorizontalCollision(CollisionList); velocity.Y += gravity; position.Y += velocity.Y; VerticalCollision(CollisionList); }
public virtual void SpecialAbility(Player player) { }
public virtual void CollideWithPlayer(Player player) { if (PixelCol(HitBox(), colorArray, player.HitBox(), player.ColorArray)) player.gotKilled = true; }
public void Initialize() { EnemyManager.Reset(); Camera.ClearFocusList(); if (mapManager == null) mapManager = new MapManager(); mapManager.Initialize(); if (Player == null) Player = new Player(); Player.SetStartPos(mapManager.PlayerStartPos); Camera.ResetValues(mapManager.PlayerStartPos); Camera.DefaultFocus = Player; Camera.Position = mapManager.PlayerStartPos; Camera.Limits = new Rectangle(0, 0, MapManager.MapWidth, MapManager.MapHeight); ambientLightHandles = new List<AmbientLight>(); spotLightHandles = new List<PointLight>(); ambientLightHandles.Add(new AmbientLight(Color.White * 0.40f)); ambientLightHandles.Add(new AmbientLight(Color.White)); spotLightHandles.Add(new PointLight(Player.Position, 200, 0.8f, Color.White)); LightingManager.AmbientLights.Add(ambientLightHandles[0]); LightingManager.PointLights.Add(spotLightHandles[0]); }
public override void SpecialAbility(Player player) { if (GetDistance(position, player.Position) < range && canShoot) Shoot(player.Position); }