Наследование: MonoBehaviour
Пример #1
0
 void Start()
 {
     networking = GetComponent<Networking>();
     skillSelectUI = GetComponent<SkillSelectUI>();
     menuUI = GetComponent<MenuUI>();
     clientGameUI = GetComponent<ClientGameUI>();
 }
Пример #2
0
    public override void showMenu(float transitionTimer, MenuUI.MenuTransition path, Callback callback)
    {
        // Populate the leaderboard
        populateLeaderboard();

        // Call show menu method
        base.showMenu(transitionTimer, path, callback);
    }
Пример #3
0
    //Called when the tank's health is or under 0.
    public void Die()
    {
        if (id == 0)                        //If the tank is player 1.
        {
            if (MenuUI.getFlag() == 2)
            {
                game.lives--;
            }
            else
            {
                game.player2Score++;    //Add 1 to player 2's score.
            }
        }
        if (id == 1)                                    //If the tank is player 2.
        {
            if (MenuUI.getFlag() != 2)
            {
                game.player1Score++;    //Add 1 to player 1's score.
            }
        }

        canMove  = false;                               //The tank can now not move.
        canShoot = false;                               //The tank can now not shoot.

        //Particle Effect
        GameObject deathEffect = Instantiate(deathParticleEffect, transform.position, Quaternion.identity) as GameObject; //Spawn the death particle effect at the tank's position.

        Destroy(deathEffect, 1.5f);                                                                                       //Destroy that effect in 1.5 seconds.

        //m_Explosion3.Play();
        //teleport tank to the spawn point when it dies and clear the old path
        if (MenuUI.getFlag() == 4 && id == 1)
        {
            GetComponent <AILerp>().Teleport(game.spawnPoints[Random.Range(0, game.spawnPoints.Count)].transform.position, true);
            Respawn();
        }
        else
        {
            transform.position = new Vector3(0, 100, 0);    //Set the tanks position outside of the map, so that it is not visible when dead.
        }
        if (MenuUI.getFlag() != 2 || (MenuUI.getFlag() == 2 && id != 0))
        {
            StartCoroutine(RespawnTimer());                 //Start the RespawnTimer coroutine.
        }
        else if (game.lives == 0)
        {
            RespawnAtHome();
        }
        else if (MenuUI.getFlag() == 2 && id == 0)
        {
            game.ui.SetKillScreen();
            RespawnAtHome();                                  //just respawn
        }
    }
Пример #4
0
        public override void Load()
        {
            if (!Main.dedServ)             //won't initialize on server
            {
                MenuUI = new MenuUI();
                MenuUI.Activate();

                MyInterface = new UserInterface();
                MyInterface?.SetState(MenuUI);
            }
        }
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
            MenuUI inicio = new MenuUI(Repo);

            inicio.Show();
        }
Пример #6
0
 private static void BikeMethod(Gestor objGestor, MenuUI objMenu)
 {
     if (objGestor.BikeRegistration(objGestor.CurrentCarShop, objMenu.RequestBikeInfo()))
     {
         Console.WriteLine("\nYour bike has been admitted");
     }
     else
     {
         Console.WriteLine("\nTheres been a problem admitting your bike");
     }
 }
Пример #7
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(gameObject);
     }
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
 }
Пример #8
0
 public void returnbutton()
 {
     if (gameState == state.Win)
     {
         MenuUI.SetActive(true);
         foreach (Player p in player)
         {
             p.reset();
         }
         setPause();
     }
 }
Пример #9
0
    void damageNearbyPlayers()
    {
        //get items overlapping in the collision circle
        Collider2D[] colls = Physics2D.OverlapCircleAll(explosive.position, farAreaEffect);

        //for each item in collision
        foreach (Collider2D col in colls)
        {
            //if it was a tank
            if (col.CompareTag("Tank") && MenuUI.getFlag() != 1)
            {
                Tank  tank     = col.gameObject.GetComponent <Tank>(); //Get the tank's Tank.cs component.
                float distance = Vector3.Distance(col.transform.position, explosive.position);
                //Debug.Log("tank in explosion distance:" + distance);
                int damage = farDamage;
                if (distance <= closeAreaEffect)   //if tank is in the close to the centre Area
                {
                    damage = closeDamage;
                    //Debug.Log("close");
                }
                else if (distance <= mediumAreaEffect)   //if tank is in the middle Area
                {
                    damage = mediumDamage;
                    //Debug.Log("medium");
                }

                //aplly damage to the tank
                tank.Damage(damage);
            }

            //if it was a tank in multiplayer mode
            else if (col.CompareTag("Tank"))
            {
                TankMultiplayer tank     = col.gameObject.GetComponent <TankMultiplayer>(); //Get the tank's Tank.cs component.
                float           distance = Vector3.Distance(col.transform.position, explosive.position);
                //Debug.Log("tank in explosion distance:" + distance);
                int damage = farDamage;
                if (distance <= closeAreaEffect)   //if tank is in the close to the centre Area
                {
                    damage = closeDamage;
                    //Debug.Log("close");
                }
                else if (distance <= mediumAreaEffect)   //if tank is in the middle Area
                {
                    damage = mediumDamage;
                    //Debug.Log("medium");
                }

                //aplly damage to the tank
                tank.Damage(damage);
            }
        }
    }
Пример #10
0
    void OnGUI()
    {
        if (FSM.CurrentState == null)
        {
            return;
        }

        // This is how you can get your object back
        MenuUI ui = (MenuUI)FSM.CurrentState.StateObject;

        ui.DoGUI();
    }
Пример #11
0
        public void StartHide()
        {
            LogoName.rectTransform.DOAnchorPosY(145.6f, 0.5f).OnComplete(() =>
            {
                LogoName.Hide();
            });

            MenuUI.DOAnchorPosY(-84.91797f, 0.5f).OnComplete(() =>
            {
                MenuUI.Hide();
            });
        }
Пример #12
0
        /// <summary>
        ///     Initialize the UIManager.
        /// </summary>
        public override void Initialize()
        {
            // The UIContentManager needs to be created with the game as a parameter.
            UIContentManager.CreateInstance(Game);

            MenuUI    = new MenuUI(Game);
            SettingUI = new SettingsUI(Game);

            _spriteBatch = new SpriteBatch(Game.GraphicsDevice);

            base.Initialize();
        }
Пример #13
0
    //Called when the tank has been dead and is ready to rejoin the game.
    public void Respawn()
    {
        canMove  = true;
        canShoot = true;

        health = maxHealth;

        if (!(MenuUI.getFlag() == 4 && id == 1))
        {
            transform.position = game.spawnPoints[Random.Range(0, game.spawnPoints.Count)].transform.position;  //Sets the tank's position to a random spawn point.
        }
    }
Пример #14
0
 void Start()
 {
     listeSelectedKeepers = new List <string>();
     goCardChildren       = new List <List <GameObject> >();
     goCardsLevels        = new List <GameObject>();
     goCardsInfo          = new List <GameObject>();
     leveldb     = GameManager.Instance.leveldb;
     menuUi      = GetComponent <MenuUI>();
     hasBeenInit = false;
     menuUi.UpdateStartButton();
     Cursor.SetCursor(GameManager.Instance.Texture2DUtils.iconeMouse, Vector2.zero, CursorMode.Auto);
 }
Пример #15
0
 public void OnSceneLoaded(Scene arg, LoadSceneMode hiBrian)
 {
     try
     {
         if (arg.name == "MenuCore")
         {
             MenuUI.CreateUI();
         }
     }catch (Exception e)
     {
         Log(e.ToString(), LogInfo.Fatal, "Install your dependencies!");
     }
 }
Пример #16
0
    public void Setup()
    {
        Cursor.visible = false;

        if (MainMenu)
        {
            currentMenu        = MainMenu;
            activeMenuPosition = currentMenu.transform.position;
            TutorialSelectionText.transform.localScale = Vector3.zero;
            ModeMenu.transform.position = activeMenuPosition + new Vector2(MENU_DISTANCE, 0);
            BackUI.transform.localScale = Vector3.zero;
        }
    }
Пример #17
0
        private GameManager gameManager; // Reference to Gamemanager Singleton

        // On entering state,
        //  Create menuUI with current state's contentManager
        public override void Enter(Game1 game)
        {
            gameManager = GameManager.Instance;
            menuUI      = new MenuUI(stateContentManager);

            finalScore = gameManager.CurrentScore;
            // UpdateScores?.Invoke(finalScore);

            gameManager.UpdateAwardsFileWithNewScore(finalScore);
            gameManager.DeleteSaveFile(); // Deletes old save

            base.Enter(game);
        }
Пример #18
0
 public MenuBase(MenuUI menuUI, GameObject lootPanel)
 {
     this.menuUI       = menuUI; // 해당 객체의 메소드를 쓸 일이 있음.
     this.lootPanel    = lootPanel;
     this.btn_continue = lootPanel.transform.GetChild(1).GetChild(0).GetComponent <Button>();
     this.btn_save     = lootPanel.transform.GetChild(1).GetChild(1).GetComponent <Button>();
     this.btn_option   = lootPanel.transform.GetChild(1).GetChild(2).GetComponent <Button>();
     this.btn_close    = lootPanel.transform.GetChild(1).GetChild(3).GetComponent <Button>();
     btn_continue.onClick.AddListener(act_continue);
     btn_save.onClick.AddListener(act_save);
     btn_option.onClick.AddListener(act_option);
     btn_close.onClick.AddListener(act_close);
 }
Пример #19
0
 void spawnPlayer()
 {
     /*if (PhotonNetwork.LocalPlayer == PhotonNetwork.PlayerList[0]) {
      *  photonView.RPC("updateName", PhotonNetwork.PlayerList[1], PhotonNetwork.PlayerList[1].NickName);
      * }
      * if (PhotonNetwork.LocalPlayer == PhotonNetwork.PlayerList[1]) {
      *  photonView.RPC("updateName", PhotonNetwork.PlayerList[0], PhotonNetwork.PlayerList[0].NickName);
      * }*/
     if (MenuUI.getFlag() == 1 && photonView.IsMine)
     {
         // LocalPlayer = PhotonNetwork.Instantiate("PlayerMultiplayer", Vector3.zero, Quaternion.identity).GetComponent<TankMultiplayer>();
         PhotonNetwork.Instantiate("PlayerMultiplayer", player.transform.position, player.transform.rotation, 0);
     }
 }
    private void Start()
    {
        sprites = new Sprite[GameInformation.instance.playerInfo.Count];

        for (int i = 0; i < sprites.Length; i++)
        {
            sprites[i] = GameInformation.instance.playerInfo[i].unitSprite;
        }

        animator = GetComponent <Animator>();
        menuUI   = GetComponentInParent <MenuUI>();

        animator.enabled = false;
    }
Пример #21
0
 // Update is called once per frame
 void Update()
 {
     //Pause or resume game if user presses escape and he/she is not in the multiplayer menu
     if (Input.GetKeyDown(KeyCode.Escape) && MenuUI.getFlag() != 1)
     {
         if (GameIsPaused)
         {
             Resume();       //Resume Game
         }
         else
         {
             Pause();        //Pause Game
         }
     }
 }
Пример #22
0
        public void OnApplicationStart()
        {
            try
            {
                harmonyInstance = new Harmony(harmonyId);
                harmonyInstance.PatchAll(System.Reflection.Assembly.GetExecutingAssembly());
            }
            catch (Exception ex)
            {
                Log($"{ex.Message}", LogInfo.Fatal, "Unable to apply Harmony patches. Did you even install BSIPA correctly?");
            }

            CountersController.OnLoad();
            MenuUI.CreateUI();
        }
Пример #23
0
    void Awake()
    {
        menuUI = FindObjectOfType <MenuUI>();
        if (menuUI != null)
        {
            SetDisplay(menuUI.IsBonusActive);
        }

        GetComponent <Button>().onClick.AddListener(() =>
        {
            menuUI.ToggleBonusDisplay();

            SetDisplay(menuUI.IsBonusActive);
        });
    }
Пример #24
0
        public override void Awake()
        {
            canvas  = GameObject.Find("Canvas");
            sideBar = Auxiliary.FindObject(Auxiliary.FindObject(canvas, "MenuPanel"), "SideBar");

            menuUI = StateMachine.SceneGlobal.GetComponent <MenuUI>();

            robotControlsButtonImage  = Auxiliary.FindObject(sideBar, "RobotControlsButton").GetComponent <Image>();
            globalControlsButtonImage = Auxiliary.FindObject(sideBar, "GlobalControlsButton").GetComponent <Image>();
            settingsButtonImage       = Auxiliary.FindObject(sideBar, "SettingsButton").GetComponent <Image>();
            viewReplaysButtonImage    = Auxiliary.FindObject(sideBar, "ViewReplaysButton").GetComponent <Image>();
            helpButtonImage           = Auxiliary.FindObject(sideBar, "HelpButton").GetComponent <Image>();

            selectedButtonImage   = Resources.Load <Sprite>("Images/New Textures/greenButton");
            unselectedButtonImage = Resources.Load <Sprite>("Images/New Textures/TopbarHighlight");
        }
Пример #25
0
 private void Start()
 {
     if (MU == null)
     {
         MU = this;
     }
     else
     {
         if (MU != this)
         {
             Destroy(this.gameObject);
         }
     }
     copy();
     DontDestroyOnLoad(this.gameObject);
 }
Пример #26
0
    public void GoToTutorialSelectionMenu()
    {
        //UI
        currentMenu.DeselectAll();
        currentMenu.enabled = false;
        currentMenu.FadeButtons(false, MENU_TRANSITION_DURATION);
        currentMenu.transform.DOMoveX(activeMenuPosition.x - MENU_DISTANCE, MENU_TRANSITION_DURATION);

        currentMenu = TutorialSelectionMenu;

        currentMenu.SelectFirst();
        currentMenu.FadeButtons(true, MENU_TRANSITION_DURATION);

        TutorialSelectionText.transform.DOScale(1, MENU_TRANSITION_DURATION).SetEase(Ease.OutCubic).onComplete += () => currentMenu.enabled = true;

        BackUI?.transform.DOScale(0, MENU_TRANSITION_DURATION).SetEase(Ease.OutCubic);
    }
Пример #27
0
 public void selectPlayer(int id)
 {
     /*player [0] = new Player ("playerA",0,id==0?true:false);
     *  player [1] = new Player ("playerB",0,id==1?true:false);
     *  player [2] = new Player ("playerC",0,id==2?true:false);
     *  player [3] = new Player ("playerD",0,id==3?true:false);*/
     myID      = id;
     currentID = -1;
     //start game countdown
     MenuUI.SetActive(false);
     myTeam       = myTeamObj.GetComponent <Text> ();
     myTeam.text  = teams [myID];
     myTeam.color = teamColor [myID];
     timer        = turnTime;
     setCameraTeam();
     gameStart();
 }
Пример #28
0
    /// <summary>
    /// Go to main menu
    /// </summary>
    public void GoToMainMenu()
    {
        //UI
        currentMenu.DeselectAll();
        currentMenu.enabled = false;
        currentMenu.FadeButtons(false, MENU_TRANSITION_DURATION);
        currentMenu.transform.DOMoveX(activeMenuPosition.x + MENU_DISTANCE, MENU_TRANSITION_DURATION);

        currentMenu = MainMenu;

        currentMenu.FadeButtons(true, MENU_TRANSITION_DURATION);
        currentMenu.SelectFirst();
        currentMenu.transform.DOMoveX(activeMenuPosition.x, MENU_TRANSITION_DURATION).onComplete += () => currentMenu.enabled = true;

        //BACKGROUNDS
        MenuBackgrounds.transform.DOMoveY(BACKGROUNDS_DISTANCE * MAIN_MENU_INDEX, MENU_TRANSITION_DURATION);

        BackUI?.transform.DOScale(0, MENU_TRANSITION_DURATION).SetEase(Ease.OutCubic);
    }
Пример #29
0
    /// <summary>
    /// Set the current active menu for this slot
    /// </summary>
    public void SetMenu(MenuUI Menu, bool StartShown)
    {
        // Same menu, so just update visibility
        if (Menu == mActiveMenu && mActiveMenu != null)
        {
            if (StartShown)
            {
                mActiveMenu.ShowMenu();
            }
            else
            {
                mActiveMenu.HideMenu();
            }
            return;
        }


        // Replace menu
        if (mActiveMenu != null)
        {
            mActiveMenu.DestroyMenu();
        }

        mActiveMenu = Menu;

        if (mActiveMenu == null)
        {
            return;
        }


        // Create and update visibility
        mActiveMenu.CreateMenu(mRectTransform);

        if (StartShown)
        {
            mActiveMenu.ShowMenu();
        }
        else
        {
            mActiveMenu.HideMenu();
        }
    }
Пример #30
0
    void ProjectileSimple(Collision2D col)
    {
        if (col.gameObject.tag == "Tank" && MenuUI.getFlag() != 1)
        {                                                     //Is the object we hit a tank?
            Tank tank = col.gameObject.GetComponent <Tank>(); //Get the tank's Tank.cs component.

            if (!game.canDamageOwnTank)
            {                            //Can we not damage our own tank?
                if (tank.id != tankId)   //Is the tank we hit not the one that shot this projectile?
                {
                    tank.Damage(damage); //Call the damage function on that tank to damage it.
                }
            }
            else
            {
                tank.Damage(damage);
            }
        }
        else if (col.gameObject.tag == "Tank")
        {//Is the object we hit a tank?
            Debug.Log("tankMultiplayer");
            TankMultiplayer tank = col.gameObject.GetComponent <TankMultiplayer>();

            /*if (!game.canDamageOwnTank)
             * {                       //Can we not damage our own tank?
             *  if (tank.id != tankId)
             *  {                           //Is the tank we hit not the one that shot this projectile?
             *      tank.Damage(damage);                        //Call the damage function on that tank to damage it.
             *  }
             * }*/
            //else
            //{
            tank.Damage(damage);
            //}
        }

        GameObject hitEffect1 = Instantiate(hitParticleEffect, transform.position, Quaternion.identity) as GameObject;

        Destroy(hitEffect1, 1.0f);
        Destroy(gameObject);
    }
Пример #31
0
 private void onPingResponded(gameserveritem_t data)
 {
     this.isAttemptingServerQuery = false;
     this.cleanupServerQuery();
     if (data.m_nAppID == Provider.APP_ID.m_AppId)
     {
         SteamServerInfo steamServerInfo = new SteamServerInfo(data);
         if (!steamServerInfo.isPro || Provider.isPro)
         {
             if (!steamServerInfo.isPassworded || this.connectionInfo.password != string.Empty)
             {
                 if (this.autoJoinServerQuery)
                 {
                     Provider.connect(steamServerInfo, this.connectionInfo.password);
                 }
                 else
                 {
                     MenuUI.closeAll();
                     MenuUI.closeAlert();
                     MenuPlayServerInfoUI.open(steamServerInfo, this.connectionInfo.password, MenuPlayServerInfoUI.EServerInfoOpenContext.CONNECT);
                 }
             }
             else
             {
                 Provider._connectionFailureInfo = ESteamConnectionFailureInfo.PASSWORD;
             }
         }
         else
         {
             Provider._connectionFailureInfo = ESteamConnectionFailureInfo.PRO_SERVER;
         }
     }
     else
     {
         Provider._connectionFailureInfo = ESteamConnectionFailureInfo.TIMED_OUT;
     }
     if (this.onTimedOut != null)
     {
         this.onTimedOut();
     }
 }
Пример #32
0
    private void Update()
    {
        base.Update();
        RaycastHit hit;

        if (Physics.Raycast(pointer.transform.position, pointer.transform.TransformDirection(Vector3.forward), out hit))
        {
            Debug.DrawRay(pointer.transform.position, pointer.transform.TransformDirection(Vector3.forward), Color.blue);
            GameObject hitObject = hit.transform.gameObject;
            MenuUI     menObj    = hitObject.GetComponent <MenuUI>();
            if (menObj)
            {
                Debug.Log("Point At Button");
                menObj.GetSelected();
            }
        }
        if (coolNow > 0)
        {
            coolNow -= Time.deltaTime;
        }
    }
Пример #33
0
 protected void Awake() {
     Instance = this;
 }
Пример #34
0
 void Start()
 {
     networking = GetComponent<Networking>();
     menuUI = GetComponent<MenuUI>();
     drawStatsUI = GetComponent<DrawStatsUI>();
 }
Пример #35
0
 void Start()
 {
     menuUI = GetComponent<MenuUI>();
     serverGameUI = GetComponent<ServerGameUI>();
 }
Пример #36
0
    // Instantiate variables and references here
    void Awake()
    {
        // Initialize the manager objects
        Instance = this;
        player = GameObject.FindObjectOfType<Player>();
        levelManager = GameObject.FindObjectOfType<LevelHandler>();

        // Initialize all UI menu object references
        menuManager = GameObject.FindObjectOfType<MenuHandler>();
        mainMenu = menuManager.getMenu("MainMenuScreen");
        pauseMenu = menuManager.getMenu("PauseScreen");
        restartMenu = menuManager.getMenu("ResetScreen");
        storeMenu = menuManager.getMenu("StoreScreen");
        creditsMenu = menuManager.getMenu("CreditsScreen");
        leaderboardMenu = menuManager.getMenu("LeaderboardScreen");
        menuFader = GameObject.Find("CanvasTransition").GetComponent<CanvasGroup>();
        displayBoard = GameObject.FindObjectOfType<DisplayUI>();

        // Initialize full screen effects here
        cameraMotionBlur = GameObject.FindObjectOfType<CameraMotionBlur>();

        // Fader UI object visible on start
        menuFader.alpha = 1.0f;

        // Initialize default game state
        moneyMultiplier = 1.0f;
        distanceRecord = 500.0f;
        initializeCameraEffects();
        initializeMainMenu();
    }
Пример #37
0
 public override void showMenu(float transitionTimer, MenuUI.MenuTransition path, Callback callback)
 {
     // Call show menu method
     base.showMenu(transitionTimer, path, callback);
 }
Пример #38
0
    /// <summary>
    /// Show a menu screen
    /// </summary>
    public void show(MenuUI menu, float transitionTime = 0.5f, Callback callback = null)
    {
        MenuUI currentMenu = getCurrentMenu;

        // Add menu to traversal history
        history.Push(menu);

        // Hide the currently opened menu if there is a menu that is open, then once the transition completes, show the new menu
        if (currentMenu != null) {
            currentMenu.hideMenu(transitionTime, MenuUI.MenuTransition.FORWARD, () => { menu.showMenu(transitionTime, MenuUI.MenuTransition.FORWARD, callback); });
        }
        else {
            menu.showMenu(transitionTime, MenuUI.MenuTransition.FORWARD, callback);
        }
    }
Пример #39
0
 void Start()
 {
     menuUI = GetComponent<MenuUI>();
 }
Пример #40
0
 public override void showMenu(float transitionTimer, MenuUI.MenuTransition path, Callback callback)
 {
     // Set the total money text then call show menu
     currentMoney.text = Manager.totalMoney.ToString();
     base.showMenu(transitionTimer, path, callback);
 }
Пример #41
0
 void Start()
 {
     menuUI = GetComponent<MenuUI>();
     clientConnectingUI = GetComponent<ClientConnectingUI>();
 }
Пример #42
0
 // Use this for initialization
 void Start()
 {
     UI = Camera.main.GetComponent<MenuUI>();
     Players = new List<PlayerInfo>();
     AmountOfPlayers = 0;
     DiceTimer = 0.0f;
     DiceNumbers = new int[15];
     KeyPressed = false;
     AbleToStop = false;
     DontDestroyOnLoad(this);
 }