Example #1
0
 public ModelManager(Game game, ScreenManager screenManager)
     : base(game)
 {
     this.game = game;
     this.screenManager = screenManager;
     this.texManager = ((Spectrum)game).texManager;
     this.buttonHandler = new ButtonHandler(game);
 }
Example #2
0
 public ScreenManager(Game game = null, Bubble player = null)
     : base(game)
 {
     this.game = game;
     this.player = player;
     this.texManager = ((Spectrum)game).getTexManager();
     lifeTexture = texManager.getUITexture(SpectrumEnums.icons.life);
     splashScreenTexture = texManager.getSplashScreen(SpectrumEnums.splashScreen.start);
 }
Example #3
0
 public Button(Vector2 position, Game game, SpectrumEnums.buttons buttonId = SpectrumEnums.buttons.levelSelection)
 {
     this.texManager = ((Spectrum)game).texManager;
     this.currentbuttonId = buttonId;
     this.game = game;
     scale = 1;
     textureUp = texManager.getButtonTextureNormal(buttonId);
     textureDown = texManager.getButtonTextureClicked(buttonId);
     textureOver = texManager.getButtonTextureHover(buttonId);
     activeTexture = textureUp;
     int scaledTexWidth = (int)(textureUp.Width * scale);
     int scaledTexHeight = (int)(textureUp.Height * scale);
     origin = new Vector2(textureUp.Width / 2f, textureUp.Height / 2f);
     recPosition = new Rectangle((int)position.X - (int)origin.X, (int)position.Y - (int)origin.Y, textureUp.Width, textureUp.Height);
     center = new Vector2(position.X + recPosition.Width / 2f, position.Y + recPosition.Height / 2f);
     this.position = position;
 }
Example #4
0
 public Button(Vector2 position, Game game, SpectrumEnums.icons iconId = SpectrumEnums.icons.close)
 {
     this.texManager = ((Spectrum)game).texManager;
     this.currentIconId = iconId;
     this.currentbuttonId = SpectrumEnums.buttons.None;
     this.game = game;
        // this.padlock = texManager.getPadlockTexture();
     isIcon = true;
     textureUp = texManager.getUITexture(iconId);
     textureDown = textureUp;
     textureOver = textureUp;
     activeTexture = textureUp;
     int scaledTexWidth = (int)(textureUp.Width * scale);
     int scaledTexHeight = (int)(textureUp.Height * scale);
     // TODO fix scaling problem
     origin = new Vector2(scaledTexWidth / 2f, scaledTexHeight / 2f);
     recPosition = new Rectangle((int)position.X - (int)origin.X, (int)position.Y - (int)origin.Y, scaledTexWidth, scaledTexHeight);
     center = new Vector2(position.X + recPosition.Width / 2f, position.Y + recPosition.Height / 2f);
     this.position = position;
 }
Example #5
0
        public BasicCube(Model model, Game game, SpectrumEnums.Cubes face, Camera camera, Vector3 offset, ModelManager modelManager)
            : base(model, game)
        {
            effect = ((Spectrum)game).grayEffect;
            this.camera = camera;
            this.game = game;
            this.texManager = ((Spectrum)game).texManager;
            cubeM = model;
            this.offset = offset;
            translation = Matrix.CreateTranslation(offset);
            this.modelManager = modelManager;
            texture = texManager.getCubeTexture(face);
            boundingBox = GetBoundingBox();
            this.left = offset.X - 1;
            this.right = offset.X + 1;
            this.down = offset.Y - 1;
            this.top = offset.Y + 1;
            this.rear = offset.Z - 1;
            this.front = offset.Z + 1;

            switch(face)
            {
                case SpectrumEnums.Cubes.Start:
                    posXFace = new StartFace(this, modelManager, 0);
                    negXFace = new StartFace(this, modelManager, 1);
                    posYFace = new StartFace(this, modelManager, 2);
                    negYFace = new StartFace(this, modelManager, 3);
                    posZFace = new StartFace(this, modelManager, 4);
                    negZFace = new StartFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Goal:
                    posXFace = new GoalFace(this, modelManager, 0);
                   negXFace = new GoalFace(this, modelManager, 1);
                    posYFace = new GoalFace(this, modelManager, 2);
                    negYFace = new GoalFace(this, modelManager, 3);
                    posZFace = new GoalFace(this, modelManager, 4);
                    negZFace = new GoalFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Grass:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Ice:
                    posXFace = new IceFace(this, modelManager, 0);
                    negXFace = new IceFace(this, modelManager, 1);
                    posYFace = new IceFace(this, modelManager, 2);
                    negYFace = new IceFace(this, modelManager, 3);
                    posZFace = new IceFace(this, modelManager, 4);
                    negZFace = new IceFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Mud:
                    posXFace = new MudFace(this, modelManager, 0);
                    negXFace = new MudFace(this, modelManager, 1);
                    posYFace = new MudFace(this, modelManager, 2);
                    negYFace = new MudFace(this, modelManager, 3);
                    posZFace = new MudFace(this, modelManager, 4);
                    negZFace = new MudFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Lava:
                    posXFace = new LavaFace(this, modelManager, 0);
                    negXFace = new LavaFace(this, modelManager, 1);
                    posYFace = new LavaFace(this, modelManager, 2);
                    negYFace = new LavaFace(this, modelManager, 3);
                    posZFace = new LavaFace(this, modelManager, 4);
                    negZFace = new LavaFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Cobblestone:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Sponge:
                    posXFace = new SpongeFace(this, modelManager, 0);
                    negXFace = new SpongeFace(this, modelManager, 1);
                    posYFace = new SpongeFace(this, modelManager, 2);
                    negYFace = new SpongeFace(this, modelManager, 3);
                    posZFace = new SpongeFace(this, modelManager, 4);
                    negZFace = new SpongeFace(this, modelManager, 5);
                    break;
                case SpectrumEnums.Cubes.Error:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
                default:
                    posXFace = new NeutralFace(this, modelManager, 0);
                    negXFace = new NeutralFace(this, modelManager, 1);
                    posYFace = new NeutralFace(this, modelManager, 2);
                    negYFace = new NeutralFace(this, modelManager, 3);
                    posZFace = new NeutralFace(this, modelManager, 4);
                    negZFace = new NeutralFace(this, modelManager, 5);
                    break;
            }
        }
Example #6
0
        //================== Music Settings Bars =====================//
        public PopUp(Game game, ScreenManager screenManager, Bubble player, SpectrumEnums.popUpId style = SpectrumEnums.popUpId.custom, string headline = "", string text = "")
        {
            this.position = new Vector2(game.Window.ClientBounds.Width / 2f, game.Window.ClientBounds.Height / 2f);
            this.game = game;
            this.texManager = ((Spectrum)game).texManager;
            this.screenManager = screenManager;
            this.player = player;
            this.headlineFont = screenManager.modelManager.getHeadlineFont();
            this.textFont = screenManager.modelManager.getTextFont();
            this.buttonHandler = screenManager.modelManager.buttonHandler;

            popUpTexture = texManager.getUITexture(style);
            currentStyle = style;
            switch (style)
            {
                case SpectrumEnums.popUpId.custom:
                    this.headline = headline;
                    this.text = text;
                    break;
                case SpectrumEnums.popUpId.win:
                    this.headline = "Congratulations!";
                    this.text = "You beat the level! \n You can go on with the next level \nor play again.";
                    break;
                case SpectrumEnums.popUpId.lose:
                    this.headline = "Game over";
                    this.text = "You lose, try again!";
                    break;
            }
            origin = new Vector2(popUpTexture.Width / 2f, popUpTexture.Height / 2f);
            center = new Vector2(position.X + recPosition.Width / 2f, position.Y + recPosition.Height / 2f);
            recPosition = new Rectangle((int)position.X - (int)origin.X, (int)position.Y - (int)origin.Y, popUpTexture.Width, popUpTexture.Height);
            setButtons();
        }