コード例 #1
0
        public void Awake()
        {
            instance    = this;
            thisObj     = gameObject;
            canvasGroup = thisObj.GetComponent <CanvasGroup>();
            if (canvasGroup == null)
            {
                canvasGroup = thisObj.AddComponent <CanvasGroup>();
            }

            if (!Enabled())
            {
                thisObj.SetActive(false);
                return;
            }

            butClose.Init();
            butClose.SetCallback(null, null, this.OnCloseButton, null);

            uiStatsTab.gameObject.SetActive(enableStatsTab);

            uiLPerkTabDisplay.gameObject.SetActive(perkTabType == _PerkTabType.LevelList);
            uiPerkTabList.gameObject.SetActive(perkTabType == _PerkTabType.RepeatableList);
            uiPerkTab.gameObject.SetActive(perkTabType == _PerkTabType.Item);
        }
コード例 #2
0
        public void _ShowLevelPerkMenu()
        {
            CameraControl.FadeBlur(uiBlurEffect, 0, 2);
            CameraControl.TurnBlurOn();
            GameControl.PauseGame();                    //Telling GameControl to paause the game
            UILevelPerkMenu.Show();

            TDSTouchInput.Hide();

            Time.timeScale = 0;
        }
コード例 #3
0
        public IEnumerator _CloseLevelPerkMenu()
        {
            CameraControl.FadeBlur(uiBlurEffect, 2, 0);
            CameraControl.TurnBlurOff();
            UILevelPerkMenu.Hide();

            TDSTouchInput.Show();

            yield return(StartCoroutine(WaitForRealSeconds(0.25f)));

            Time.timeScale = 1;
            GameControl.ResumeGame();                   //Telling GameControl to resume the game
        }
コード例 #4
0
        void Start()
        {
            player = GameControl.GetPlayer();

            joystickAim.transform.parent.gameObject.SetActive(player.enableTurretRotate);
            fireButton.SetActive(!player.enableTurretRotate);

            if (!UIMainControl.EnableItemSelectTab())
            {
                weaponAbilityTabButton.SetActive(false);
            }
            if (!UILevelPerkMenu.Enabled())
            {
                levelPerkButton.SetActive(false);
            }
            Debug.Log("StartStart  " + UILevelPerkMenu.Enabled());
        }
コード例 #5
0
        void Update()
        {
            if (!enableMouseNKeyInput)
            {
                return;
            }

            if (Input.GetButtonDown("Cancel") || Input.GetKeyDown(KeyCode.Escape) && !GameControl.IsGameOver())
            {
                _TogglePause();
            }
            //if(Input.GetKeyDown(KeyCode.C) && !GameControl.IsGameOver()) ToggleLevelPerkMenu();

            /*
             * if(Input.GetKeyDown(KeyCode.Q)){
             *      Debug.Log("Paused for screen shot. Fire from UIMainControl");
             *      if(Time.timeScale==1) Time.timeScale=0;
             *      else Time.timeScale=1;
             * }
             */

            if (GameControl.IsGamePlaying())
            {
                UnitPlayer player = GameControl.GetPlayer();
                if (player != null && !player.IsDestroyed() && Input.touchCount == 0)
                {
                    //Debug.Log("Fire!!  "+Time.time);

                    //movement
                    if (Input.GetButton("Horizontal") || Input.GetButton("Vertical"))
                    {
                        player.Move(new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical")), Input.GetKey(KeyCode.LeftShift));
                    }

                    //brake
                    if (Input.GetKey(KeyCode.Space))
                    {
                        player.Brake();
                    }

                    //switch weapon
                    if (Input.GetAxisRaw("Mouse ScrollWheel") != 0 && scrollCD <= 0)
                    {
                        player.ScrollWeapon(Input.GetAxis("Mouse ScrollWheel") > 0 ? 1 : -1);
                        scrollCD = 0.15f;
                    }
                    scrollCD -= Time.deltaTime;

                    string[] names       = Input.GetJoystickNames();
                    bool     hasJoystick = names.Length > 0 ? true : false;

                    //turret facing
                    //player.AimTurretMouse(Input.mousePosition);
                    //player.AimTurretDPad(Input.mousePosition-new Vector3(Screen.width/2, Screen.height/2));
                    if (Input.GetButton("RightThumbStick_X") || Input.GetButton("RightThumbStick_Y"))
                    {
                        player.AimTurretDPad(new Vector2(Input.GetAxisRaw("RightThumbStick_X"), Input.GetAxisRaw("RightThumbStick_Y")));
                    }
                    else if (!hasJoystick)
                    {
                        player.AimTurretMouse(Input.mousePosition);
                    }

                    //fire
                    bool continousFire = player.ContinousFire() & (Input.GetMouseButton(0) || Input.GetButton("Fire1"));
                    if (Input.GetMouseButtonDown(0) || Input.GetButtonDown("Fire1") || continousFire)
                    {
                        player.FireWeapon();
                    }

                    //alt fire, could fire weapon alt-mode to launch selected ability
                    if (Input.GetMouseButtonDown(1) || Input.GetButtonDown("Fire2"))
                    {
                        player.FireAbility();
                    }

                    //launch ability
                    if (Input.GetMouseButtonDown(2) || Input.GetButtonDown("Fire3"))
                    {
                        player.FireAbilityAlt();
                    }

                    //reload
                    if (Input.GetKeyDown(KeyCode.R) || Input.GetButtonDown("Jump"))
                    {
                        player.Reload();
                    }

                    //bring up the chracter & perk menu
                    if (UILevelPerkMenu.Enabled() && Input.GetKeyDown(KeyCode.C))
                    {
                        ToggleLevelPerkMenu();
                    }
                }
            }
        }
コード例 #6
0
 void OnPlayerRespawn()
 {
     UILevelPerkMenu.OnPlayerRespawn(GameControl.GetPlayer());
 }