private bool TryAddBarrier(MapTile tile, Point location) { BlockType blockType; switch (tile) { case MapTile.InvisibleWall: blockType = BlockType.InvisibleBlock; break; case MapTile.BlackBarrier: blockType = BlockType.BlackBarrier; break; case MapTile.InvisibleProjectileBarrier: blockType = BlockType.InvisibleProjectileBarrier; break; default: return(false); } var barrier = new Barrier(location, blockType); Collidables.Add(barrier); Drawables.Add(barrier); return(true); }
private bool TryAddNonStandardTiles(MapTile tile, Point location) { // ReSharper disable once SwitchStatementMissingSomeCases (cases are covered elsewhere) switch (tile) { case MapTile.Key: Items.Add(new Key(location, this)); break; case MapTile.Compass: Items.Add(new Compass(location)); break; case MapTile.Map: Items.Add(new Map(location)); break; case MapTile.Bow: Items.Add(new BowItem(location, Secondary.Bow, 10)); break; case MapTile.Triforce: Items.Add(new Triforce(location)); break; case MapTile.PushableBlock: var pushableBlock = new MovableBlock(location); Collidables.Add(pushableBlock); Drawables.Add(pushableBlock); TransitionResetables.Add(pushableBlock); break; case MapTile.SpawnEnemy: SpawnTiles.Add(location); break; case MapTile.Sand: Drawables.Add(new Overlay(location, BlockType.Sand)); break; case MapTile.Heart: Items.Add(new HeartContainer(location, this)); break; case MapTile.Boomerang: Items.Add(new BoomerangItem(location, this, 20)); break; case MapTile.BasementBricks: case MapTile.BlackOverlay: case MapTile.None: case MapTile.Room2_1Block: break; default: return(false); } return(true); }
private bool TryAddStair(MapTile tile, Point location) { BlockType blockType; switch (tile) { case MapTile.DungeonStairs: blockType = BlockType.DungeonStair; break; case MapTile.BasementStairs: blockType = BlockType.BasementStair; break; case MapTile.StairSpecialUp1_1: blockType = BlockType.StairSpecialUp1_1; break; default: return(false); } var stairs = new Stair(_dungeonManager, location, blockType); Collidables.Add(stairs); Drawables.Add(stairs); return(true); }
private bool TryAddSpecialDoor(MapTile tile, Point location) { DoorBase door; Direction direction; switch (tile) { case MapTile.DoorSpecialLeft2_1: door = new DoorSpecialLeft2_1(_dungeonManager, location); direction = Direction.Left; break; case MapTile.DoorSpecialRight3_1: door = new DoorSpecialRight3_1(_dungeonManager, location); direction = Direction.Right; break; default: return(false); } Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
private bool TryAddNormalDoor(MapTile tile, Point location) { BlockType blockType; Direction direction; // ReSharper disable once SwitchStatementMissingSomeCases switch (tile) { case MapTile.DoorUp: blockType = BlockType.DoorUp; direction = Direction.Up; break; case MapTile.DoorDown: blockType = BlockType.DoorDown; direction = Direction.Down; break; default: return(false); } var door = new NormalDoor(_survivalManager, location, blockType); Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
private bool TryAddProjectilPassthroughBarrier(MapTile tile, Point location) { BlockType blockType; switch (tile) { case MapTile.Fire: blockType = BlockType.Fire; break; case MapTile.Water: blockType = BlockType.Water; break; case MapTile.FishStatue: blockType = BlockType.FishStatue; break; case MapTile.DragonStatue: blockType = BlockType.DragonStatue; break; case MapTile.ImmovableBlock: blockType = BlockType.ImmovableBlock; break; case MapTile.InvisibleProjectileBarrier: blockType = BlockType.InvisibleProjectileBarrier; break; default: return(false); } var barrier = new ProjectilePassthroughBarrier(location, blockType); Collidables.Add(barrier); Drawables.Add(barrier); return(true); }
private bool TryAddLockedDoor(MapTile tile, Point location) { BlockType blockType; Direction direction; // ReSharper disable once SwitchStatementMissingSomeCases switch (tile) { case MapTile.DoorLockedRight: blockType = BlockType.DoorLockedRight; direction = Direction.Right; break; case MapTile.DoorLockedLeft: blockType = BlockType.DoorLockedLeft; direction = Direction.Left; break; case MapTile.DoorLockedUp: blockType = BlockType.DoorLockedUp; direction = Direction.Up; break; case MapTile.DoorLockedDown: blockType = BlockType.DoorLockedDown; direction = Direction.Down; break; default: return(false); } var door = new LockedDoor(_dungeonManager, location, blockType); Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
/// <summary> /// AddObject is called to add a new GameObject to the Objects list. /// </summary> /// public void AddObject(GameObject newObject) { Objects.Add(newObject); // Adds to Drawables if drawable. if (newObject is Drawable drawable) { Drawables.Add(drawable); } // Adds to Collidables if collidable. if (newObject is Collider) { Collidables.Add(newObject); } if (newObject is Player) { Player = (Player)newObject; } if (newObject is Npc) { Npcs.Add((Npc)newObject); } if (newObject is EndObject) { End = (EndObject)newObject; } if (newObject is Event) { Events.Add((Event)newObject); } }
private bool TryAddBombableWall(MapTile tile, Point location) { BlockType blockType; Direction direction; switch (tile) { case MapTile.DoorBombableLeft: blockType = BlockType.BombableWallLeft; direction = Direction.Right; break; case MapTile.DoorBombableRight: blockType = BlockType.BombableWallRight; direction = Direction.Left; break; case MapTile.DoorBombableUp: blockType = BlockType.BombableWallTop; direction = Direction.Up; break; case MapTile.DoorBombableDown: blockType = BlockType.BombableWallBottom; direction = Direction.Down; break; default: return(false); } var door = new BombDoor(_dungeonManager, location, blockType); Doors.Add(direction, door); Drawables.Add(door); Collidables.Add(door); return(true); }
private void AddToList(GameObject go) { var item = go as ICollidable; if (item != null) { Collidables.Add(item); } var moveable = go as IMoveable; if (moveable != null) { Moveables.Add(moveable); } var renderable = go as IRenderable; if (renderable != null) { Renderables.Add(renderable); } }
internal override bool ParseNodeBodyElement(string id, VRMLParser parser) { int line = parser.Line; if (id == "appliedParameters") { if (wasAppliedParameters) { AppliedParameters.AddRange(parser.ParseSFStringOrMFStringValue()); } AppliedParameters = parser.ParseSFStringOrMFStringValue(); wasAppliedParameters = true; } else if (id == "bounce") { Bounce = parser.ParseDoubleValue(); } else if (id == "collidables") { List <X3DNode> nodes = parser.ParseSFNodeOrMFNodeValue(); foreach (X3DNode node in nodes) { IX3DCollisionCollectionCollidables colls = node as IX3DCollisionCollectionCollidables; if (colls == null) { parser.ErrorParsingNode(VRMLReaderError.UnexpectedNodeType, this, id, node, line); } else { Collidables.Add(colls); } } } else if (id == "enabled") { Enabled = parser.ParseBoolValue(); } else if (id == "frictionCoefficients") { FrictionCoefficients = parser.ParseSFVec2fValue(); } else if (id == "minBounceSpeed") { MinBounceSpeed = parser.ParseDoubleValue(); } else if (id == "slipFactors") { SlipFactors = parser.ParseSFVec2fValue(); } else if (id == "softnessConstantForceMix") { SoftnessConstantForceMix = parser.ParseDoubleValue(); } else if (id == "softnessErrorCorrection") { SoftnessErrorCorrection = parser.ParseDoubleValue(); } else if (id == "surfaceSpeed") { SurfaceSpeed = parser.ParseSFVec2fValue(); } else { return(false); } return(true); }