public override void Initialize()
        {
            DeleteAllObjectsButPlatformAndPlayer();

            goodDoor = new GoodDoor(
                new Vector2(0, 380),
                new Vector2(100, 120));

            badDoor = new BadDoor(
                new Vector2(TheGame.Instance.map.Size.X - 100, 380),
                new Vector2(100, 120));


            TheGame.Instance.gameObjects.AddGameObject(goodDoor);
            TheGame.Instance.gameObjects.AddGameObject(badDoor);
        }
Exemplo n.º 2
0
        //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);
        }