Inheritance: MonoBehaviour
Beispiel #1
0
    protected virtual void Start()
    {
        canAttack        = false;
        canMove          = false;
        view             = GetComponent <PhotonView>();
        canvas           = GameObject.FindGameObjectWithTag("MenuCanvas").GetComponent <GameCanvas>();
        lifelinkParticle = Instantiate(particleLL, transform, true);
        lifelinkParticle.transform.localPosition = new Vector3(0, -0.2f, 0);
        if (view.isMine)
        {
            pool = GameObject.FindGameObjectWithTag("PrefabPool").GetComponent <PrefabPool>();
            cam.SetActive(true);
            canvasPlayer.gameObject.SetActive(true);
            menu = Instantiate(escMenuPrefab).GetComponent <EscMenu>();
            menu.gameObject.transform.SetParent(canvasPlayer.transform, false);
            menu.gameObject.SetActive(false);
            menu.p = this;
            string val = "0/" + maxUltCharges.ToString();
            canvas.GetComponent <PhotonView>().RPC("RPC_SetStats", PhotonTargets.All, 3, val, teamOn, playerNum);

            try
            {
                grabHitbox.gameObject.SetActive(true);
                grabHitbox.teamOn = teamOn;
            }
            catch
            {
                //must be Bunt.
            }
        }
    }
Beispiel #2
0
 // Use this for initialization
 void Start()
 {
     //menu = GameObject.Find("Corps").GetComponent<EscMenu>();
     menu       = GameObject.FindGameObjectWithTag("Joueur").GetComponent <EscMenu>();
     MainCanvas = GameObject.Find("PauseMenu");
     //OptionsCanvas = GameObject.Find("OptionsMenu");
 }
Beispiel #3
0
    private void Start()
    {
        pressXText_Left.enabled   = false;
        pressXText_Middle.enabled = false;
        pressXText_Right.enabled  = false;


        instance = this;

        escMenu.gameObject.SetActive(false);
    }
Beispiel #4
0
 /// <summary>
 /// Escキーでメニュー表示
 /// </summary>
 public void Display_menu_screen_in_escape_key()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         if (escMenu == null)
         {
             escMenu = Instantiate(esc_Menu_Prefab, canvasTran, false);
         }
         else
         {
             Time.timeScale = 1;
             Destroy(escMenu.gameObject);
         }
     }
 }
Beispiel #5
0
        private void LoadAllContent()
        {
            Logging.WriteLine("Loading content...");

            Gfx.Load(Content);

            MainMenu.LoadContent();
            EscMenu.LoadContent();
            FpsCounter.LoadContent();
            NewGame.LoadContent();

            ResizeWindow(this, null);
            SetState(GameState.MainMenu);

            Logging.WriteLine("Content loaded");
        }
Beispiel #6
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Gfx.BackgroundColor);
            var mousePos = input.MousePos;

            Cursor.Reset();

            Gfx.SamplerState = SamplerState.AnisotropicClamp;
            Gfx.BeginSpriteBatch();


            if (EscMenuBool)
            {
                EscMenu.Draw(gameTime, mousePos);
            }
            else
            {
                switch (State)
                {
                case GameState.MainMenu:
                    MainMenu.Draw(gameTime, mousePos);
                    break;

                case GameState.Loading:
                    LoadingScreen.Draw(gameTime, mousePos);
                    break;

                case GameState.InGame:
                    Gfx.SpriteBatch.DrawString(Gfx.Fonts.SmallFont, "Hello World.",
                                               new Vector2(3, 0), Gfx.CgccGreen);
                    break;

                case GameState.NewGame:
                    NewGame.Draw(gameTime, mousePos);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(State), State + " is an invalid state");
                }
            }

            FpsCounter.Draw(gameTime, mousePos);
            Cursor.Draw(mousePos);

            Gfx.SpriteBatch.End();
            base.Draw(gameTime);
        }
    void Awake()
    {
        if (Instance != null)
        {
            Debug.LogError("UiManager:Awake: Attempting to make a second UiManager");
            return;
        }
        Instance                   = this;
        titleScreen                = GameObject.FindWithTag("TitleScreen");
        title                      = GameObject.FindWithTag("Title");
        mainMenu                   = GameObject.FindGameObjectWithTag("Main Menu");
        lobby                      = GameObject.FindGameObjectWithTag("Lobby");
        startGameButton            = GameObject.FindObjectOfType <StartGameButton>().gameObject;
        readyToggleButton          = FindObjectOfType <ReadyButton>().gameObject;
        randomParasiteToggleButton = FindObjectOfType <RandomParasiteButton>().gameObject;
        returnToMenuPanel          = FindObjectOfType <ReturnToMenuButton>().transform.parent.gameObject;
        someoneLeftPanel           = FindObjectOfType <SomeoneLeftButton>().transform.parent.gameObject;
        escMenu                    = FindObjectOfType <EscMenu>();
        foreach (CharacterSelectButton selectButton in FindObjectsOfType <CharacterSelectButton>())
        {
            if (selectButton.characterType == CharacterType.Parasite)
            {
                selectParasiteButton = selectButton.gameObject;
            }
            else if (selectButton.characterType == CharacterType.Hunter)
            {
                selectHunterButton = selectButton.gameObject;
            }
        }
        orbUiManager = FindObjectOfType <OrbUiManager>();
        minimap      = FindObjectOfType <Minimap>();
        mainMenu.SetActive(false);
        lobby.SetActive(false);
        startGameButton.SetActive(false);
        readyToggleButton.SetActive(false);
        randomParasiteToggleButton.SetActive(false);
        returnToMenuPanel.SetActive(false);
        someoneLeftPanel.SetActive(false);
        DeactivateControls();
        DeactivateMutations();

        InitializeColourMap();
    }
Beispiel #8
0
        /// <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()
        {
            Logging.WriteLine("Initializing...");

            // TODO: Add your initialization logic here

            //this.Components.Add(new DrawableGameComponent(this));

            MainMenu   = new MainMenu();
            EscMenu    = new EscMenu();
            FpsCounter = new FpsCounter();
            NewGame    = new NewGame();

            base.Initialize();

            Logging.WriteLine("Initialized.");
            Logging.WriteLine(Logging.Level.Info);

            var loadThread = new Thread(LoadAllContent);

            LoadingScreen = new LoadingScreen(null, loadThread, Gfx.Fonts.MediumFont, "Loading Graphics");
            SetState(GameState.Loading);
            loadThread.Start();
        }
Beispiel #9
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            input.Update(gameTime, IsActive);

            if (input.Ctrl && input.Shift && input.KeyPress(Keys.B))
            {
                Logging.WriteLine(Logging.Level.Info, "Break Point");
            }


            if (input.KeyPress(Keys.Escape) && Gfx.Loaded)
            {
                EscMenuBool = !EscMenuBool;
            }

            //Fullscreen
            if (input.KeyPress(Keys.F11))
            {
                if (!Graphics.IsFullScreen)
                {
                    fullscreenPrevHeight = GraphicsDevice.Viewport.Height;
                    fullscreenPrevWidth  = GraphicsDevice.Viewport.Width;
                    Graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                    Graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
                }
                else
                {
                    Graphics.PreferredBackBufferHeight = fullscreenPrevHeight;
                    Graphics.PreferredBackBufferWidth  = fullscreenPrevWidth;
                }
                Graphics.ToggleFullScreen();
            }

            FpsCounter.Update(gameTime, input);

            if (EscMenuBool)
            {
                EscMenu.Update(gameTime, input);
            }
            else
            {
                switch (State)
                {
                case GameState.MainMenu:
                    MainMenu.Update(gameTime, input);
                    break;

                case GameState.Loading:
                    LoadingScreen.Update(gameTime, input);
                    break;

                case GameState.InGame:
                    break;

                case GameState.NewGame:
                    NewGame.Update(gameTime, input);
                    break;

                default:
                    throw new ArgumentOutOfRangeException(nameof(State), State + " is not a valid game state");
                }
            }



            base.Update(gameTime);
        }