Beispiel #1
0
    public void Initialize(BlockBoard board)
    {
        tablero  = board;
        clicked_ = false;
        changeColor();

        int w = tablero.getWidth();
        int h = tablero.getHeight();

        MovableBlock block_ = null;

        do
        {
            uint x = (uint)rnd.Next(0, w);
            uint y = (uint)rnd.Next(0, h);

            block_ = tablero.GetBlock(new Position(x, y));
        }while(block_.getType() == MovableBlock.TipoCasilla.R || block_.getType() == MovableBlock.TipoCasilla.F);

        current = block_.position;
        //print ("hellooo: " + current);
        this.transform.position = new Vector3(block_.transform.position.x, this.transform.position.y, block_.transform.position.z);
    }
Beispiel #2
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // Set up the sprites
            sprites.IsMouseSensitive = true;
            Game.SpriteManager.Add(sprites);

            // Create the big text
            title = new TextDrawableSprite(Game.GetFont(FontSize),
                "Cute God");
            title.Alignment = ContentAlignment.TopCenter;
            title.Tint = Color.White;
            sprites.Add(title);

            System.Version v = GetType().Assembly.GetName().Version;
            version = new TextDrawableSprite(Game.GetFont(SmallFontSize),
                String.Format("{0}.{1}.{2}",
                    v.Major, v.Minor, v.Build));
            version.Alignment = ContentAlignment.BottomRight;
            version.Tint = Color.FromArgb(64, Color.White);
            sprites.Add(version);

            // Create the buttons
            newGame = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("new-game"));
            newGame.Clicked += NewGameClicked;
            sprites.Add(newGame);

            settings = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("settings"));
            sprites.Add(settings);

            resume = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("resume-game"));

            if (Game.PlayMode != null)
                resume.Clicked += ResumeClicked;

            sprites.Add(resume);

            help = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("help"));
            sprites.Add(help);

            scores = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("high-scores"));
            sprites.Add(scores);

            credits = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("credits"));
            credits.Clicked += CreditsClicked;
            sprites.Add(credits);

            quit = new MainMenuButton(AssetLoader.Instance
                .CreateDrawable("quit"));
            quit.Clicked += QuitClicked;
            sprites.Add(quit);

            // Create the block viewport
            board = new BlockBoard(BoardRows, BoardColumns);
            board.BlockMovingChanged += OnBlockMovingChanged;

            viewport = new BlockViewport(board, AssetLoader.Instance);
            viewport.FocusPosition = Constants.FocusPosition;
            PopulateBoard();
            // We don't add to the sprites since we are manually
            // drawing it to add a black screen in front of it.
        }
Beispiel #3
0
        /// <summary>
        /// Indicates to the game mode that it is activated.
        /// </summary>
        public void Activate()
        {
            // Set up the sprites
            sprites.IsMouseSensitive = true;
            Game.SpriteManager.Add(sprites);

            // Create the big text
            title = new TextDrawableSprite(Game.GetFont(FontSize),
                                           "Cute God");
            title.Alignment = ContentAlignment.TopCenter;
            title.Tint      = Color.White;
            sprites.Add(title);

            System.Version v = GetType().Assembly.GetName().Version;
            version = new TextDrawableSprite(Game.GetFont(SmallFontSize),
                                             String.Format("{0}.{1}.{2}",
                                                           v.Major, v.Minor, v.Build));
            version.Alignment = ContentAlignment.BottomRight;
            version.Tint      = Color.FromArgb(64, Color.White);
            sprites.Add(version);

            // Create the buttons
            newGame = new MainMenuButton(AssetLoader.Instance
                                         .CreateDrawable("new-game"));
            newGame.Clicked += NewGameClicked;
            sprites.Add(newGame);

            settings = new MainMenuButton(AssetLoader.Instance
                                          .CreateDrawable("settings"));
            sprites.Add(settings);

            resume = new MainMenuButton(AssetLoader.Instance
                                        .CreateDrawable("resume-game"));

            if (Game.PlayMode != null)
            {
                resume.Clicked += ResumeClicked;
            }

            sprites.Add(resume);

            help = new MainMenuButton(AssetLoader.Instance
                                      .CreateDrawable("help"));
            sprites.Add(help);

            scores = new MainMenuButton(AssetLoader.Instance
                                        .CreateDrawable("high-scores"));
            sprites.Add(scores);

            credits = new MainMenuButton(AssetLoader.Instance
                                         .CreateDrawable("credits"));
            credits.Clicked += CreditsClicked;
            sprites.Add(credits);

            quit = new MainMenuButton(AssetLoader.Instance
                                      .CreateDrawable("quit"));
            quit.Clicked += QuitClicked;
            sprites.Add(quit);

            // Create the block viewport
            board = new BlockBoard(BoardRows, BoardColumns);
            board.BlockMovingChanged += OnBlockMovingChanged;

            viewport = new BlockViewport(board, AssetLoader.Instance);
            viewport.FocusPosition = Constants.FocusPosition;
            PopulateBoard();
            // We don't add to the sprites since we are manually
            // drawing it to add a black screen in front of it.
        }