public override void Initialize() { DeleteAllObjectsButPlatformAndPlayer(); choiceDoor1 = new ChoiceDoor( new Vector2(0, 400), new Vector2(100, 100)); choiceDoor2 = new ChoiceDoor( new Vector2(600, 400), new Vector2(100, 100)); TheGame.Instance.gameObjects.AddGameObject(choiceDoor1); TheGame.Instance.gameObjects.AddGameObject(choiceDoor2); }
//player //other else /* * public static GameObject GetGameObject<T>(int posX, int posY, int dimensionX, int dimensionY) where T: GameObject, new() * { * return new T( * new Vector2(posX, posY), * new Vector2(dimensionX, dimensionX)); * } */ public static GameObject get(JSON.GameObject gameObject) { GameObject toReturn = null; switch (gameObject.GameObjectType) { case "Player": toReturn = new PlayerOther(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "PlayerMe": toReturn = new PlayerMe(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Bullet": toReturn = new Bullet(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Gun": toReturn = new Gun(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Guy": toReturn = new Guy(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "GoodDoor": toReturn = new GoodDoor(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "BadDoor": toReturn = new BadDoor(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Door": toReturn = new Door(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "ChoiceDoor": toReturn = new ChoiceDoor(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Switch": toReturn = new Switch(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Block": toReturn = new Block(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Key": toReturn = new Key(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; case "Platform": toReturn = new Platform(new Vector2(gameObject.posX, gameObject.posY), new Vector2(gameObject.dimensionX, gameObject.dimensionX)); break; default: break; } return(toReturn); }