コード例 #1
0
ファイル: GameController.cs プロジェクト: ozgurtt/Blockara
    public void Start()
    {
        StateControllerInit(false);
        usingTouchControls = PD.GetSaveData().savedOptions["touchcontrols"] == 1;
        firstLaunch        = true;
        player1Human       = !PD.isDemo; player2Human = (PD.gameType == PersistData.GT.Versus);
        bh           = new BlockHandler(PD, PD.GetPuzzleLevel());
        zaps         = new List <ZappyGun>();
        zapsToDelete = new List <ZappyGun>();
        SetupCountdown();
        SetupActors();
        SetupRoundDisplay();
        SetupEasterEgg();
        specialMode = PD.useSpecial;
        height      = PD.isTutorial?6:PD.rowCount; width = 8;
        float p1Xoffset = (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? -10.1f : (PD.IsLeftAlignedHUD()?-1.5f:-5.5f), p2Xoffset = 3.0f;

        CreateBoards(p1Xoffset, p2Xoffset);
        SetUpHUDAndScores();
        if (PD.gameType == PersistData.GT.Challenge)
        {
            (board1 as BoardWarPuzzlePlayer).unlockedRow = (hud as PuzzleHUD).GetUnlockedRow();
        }
        cursor1 = CreatePlayerCursor(player1Human, p1Xoffset, 1, board1, board2);
        cursor2 = CreatePlayerCursor(player2Human || PD.override2P, p2Xoffset, 2, board2, board1, PD.override2P);
        board1.Setup(cursor1, th, bh, (player2Human || (PD.isDemo && PD.demoPlayers == 2)) ? new Vector2(-0.2f, -0.6f) : new Vector2(PD.IsLeftAlignedHUD()?-0.725f:0.75f, -0.6f), player2Human || (PD.isDemo && PD.demoPlayers == 2), true, player1Human && usingTouchControls);
        board2.Setup(cursor2, th, bh, new Vector2(0.2f, -0.6f), true, player2Human || (PD.isDemo && PD.demoPlayers == 2));
        board1.RefreshGraphics();
        board2.RefreshGraphics();
        CreateMirrors(p1Xoffset, p2Xoffset);
        mirror1.RefreshGraphics();
        mirror2.RefreshGraphics();
        SetupMouseControls(p1Xoffset);

        if (!PD.isDemo)
        {
            if (PD.gameType == PersistData.GT.Campaign)
            {
                campaign = new CampaignHandler(PD, board1 as BoardWarSpecial, board2 as BoardWarCampaign,
                                               mirror2 as BoardMirrorSpecial, cursor1 as BoardCursorWar, cursor2 as BoardCursorBot, hud as CampaignHUD, GetXMLHead());
            }
            pauseButtonSheet = Resources.LoadAll <Sprite>(SpritePaths.ShortButtons);
            pauseButton      = GetGameObject(player2Human ? (new Vector3(0.0f, -0.1f)):(new Vector3(2.5f, 0.7f)), "Pause Button", pauseButtonSheet[0], true, "HUD");
            pauseButton.SetActive(PD.usingMouse);
            pauseButton.transform.localScale = new Vector3(0.75f, 0.75f);
            FontData f = PD.mostCommonFont.Clone(); f.scale = 0.035f;
            pauseText = GetMeshText(player2Human ? (new Vector3(0.0f, 0.0f)):(new Vector3(2.5f, 0.8f)), GetXmlValue(GetXMLHead(), "pause"), f).gameObject;
            pauseText.SetActive(PD.usingMouse);
            pauseTimer = 0;
            mouseObjects.Add(pauseButton);
            mouseObjects.Add(pauseText);
        }
        else
        {
            demoCountdown = 1800;
        }
    }
コード例 #2
0
ファイル: Game.cs プロジェクト: jdiperla/Hero6
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            Util.Logger.Info("Initializing Hero6 game instance.");

            Window.Title = "Hero6";

            this.SetScale();

            this.spriteBatch = new SpriteBatch(GraphicsDevice);

            Renderer = new MonoGameRenderer(this.spriteBatch);

            this.ui = new UserInterfaceHandler(this.Content);

            this.campaign = new CampaignHandler(this.Content, this.ui);

            this.ui.Initialize();
            this.campaign.Initialize();

            Util.Logger.Info("Hero6 game instance initialized.");

            base.Initialize();
        }
コード例 #3
0
 public static void LoadUnitPreviewScene()
 {
     CampaignPlayerDataHolder.BackToMenu();
     CampaignHandler.ResetLoadedLevel();
     TABSSceneManager.LoadScene("WebTabsUnitPreview", false);
 }
コード例 #4
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            this.spriteBatch = new SpriteBatch(GraphicsDevice);

            this.campaign = new CampaignHandler(this.spriteBatch, this.Content);

            this.input.Load(this.Content);
            this.campaign.Load(this.Content);
        }