public override void VisitWall(Wall w, Vector2 _point) { w.hit(); }
public virtual void VisitWall(Wall w, Vector2 _point) { }
private void reactionToWall(Wall w, Missile m, Vector2 _point) { // Vector2 pos = m.physicsObj.body.GetWorldPoint(_man.LocalPoint); Vector2 pos = _point; GameObjManager.Instance().addExplosion(pos, m.spriteRef.color); GameObjManager.Instance().remove(batchEnum.missiles, m); playFenceHit(); PlayerManager.Instance().getPlayer(m.owner).increaseNumMissiles(); hit(); }
// Center Fences private void createTopFence() { World world = Game1.GameInstance.getWorld(); Rectangle gameScreenSize = Game1.GameInstance.gameScreenSize; // Sprite Animation /////////// Sprite wallSprite = (Sprite)DisplayManager.Instance().getDisplayObj(SpriteEnum.fenceCTop); DisplayManager.Instance().addDisplayObj(SpriteEnum.Wall, wallSprite); Sprite_Proxy wallProxy = new Sprite_Proxy(wallSprite, 150, 71, fenceScale, Color.White); Wall wall1 = new Wall(GameObjType.horzWalls, wallProxy); SBNode wallBatch = SpriteBatchManager.Instance().getBatch(batchEnum.boxs); wallBatch.addDisplayObject(wallProxy); ////////////////// // Box2D ///////////// var wallShape = new PolygonShape(); wallShape.SetAsBox(wall1.spriteRef.sprite.width / 2, wall1.spriteRef.sprite.height / 2); var fd = new FixtureDef(); fd.shape = wallShape; fd.restitution = 0.9f; fd.friction = 0.0f; fd.density = 1.0f; fd.userData = wall1; BodyDef bd = new BodyDef(); bd.type = BodyType.Static; bd.position = wall1.spriteRef.pos; var body = world.CreateBody(bd); body.CreateFixture(fd); body.SetUserData(wall1); body.Rotation = (float)(90.0f * (Math.PI / 180.0f)); GameObjManager.Instance().addGameObj(wall1); PhysicsMan.Instance().addPhysicsObj(wall1, body); ///////////////////// }
public override void VisitWall(Wall w, Vector2 _point) { reactionToMissile(this, w, _point); }