public void Visit(ShootCollision co) { foreach(Unit unit in co.objects.ToList()) { if(co.x >= unit._x && co.x <= (unit._x + unit._imageW) && //Check the horizontal collision co.y >= unit._y && co.y <= (unit._y + unit._imageH)){ //Check the vertical collision unit.state = UnitStateFactory.Instance.create("unit-dead"); unit._maxCollisions = 0; Score.getInstance().addPoint(); } } CollisionContainer.getInstance().Remove(co); }
public void Visit(ShootCollision co) { foreach (Unit unit in co.objects.ToList()) { if (co.x >= unit._x && co.x <= (unit._x + unit._imageW) && //Check the horizontal collision co.y >= unit._y && co.y <= (unit._y + unit._imageH)) //Check the vertical collision { unit.state = UnitStateFactory.Instance.create("unit-dead"); unit._maxCollisions = 0; Score.getInstance().addPoint(); } } CollisionContainer.getInstance().Remove(co); }
public void Execute() { CollisionContainer.getInstance().Add(sc); sc = null; //Clean up reference for garbage collection }
public ShootInput(Game game, List<Unit> objects) { Point p = Mouse.GetPosition(game.canvas); sc = new ShootCollision(p.X, p.Y, objects); }
public void Execute() { CollisionContainer.getInstance().Add(sc); sc = null; //Clean up reference for garbage collection }
public ShootInput(Game game, List <Unit> objects) { Point p = Mouse.GetPosition(game.canvas); sc = new ShootCollision(p.X, p.Y, objects); }