// Start is called before the first frame update void Start() { //Set up Load Save game currentLevel = saveGame.currentLevelComplete; soundController = GameObject.FindObjectOfType <SoundController>(); Time.timeScale = 1f; Debug.Log("Khoi tao" + gameState.ToString()); gameState = GameState.None; ImagePressAnyKey.SetActive(true); ImagePressAnyKey.GetComponent <Animator>().enabled = false; ImagePressAnyKey.GetComponent <Animator>().enabled = true; ImagePressAnyKey.GetComponent <Animator>().Play("PressAnyKey"); PanelButtons.SetActive(false); // PanelSetting.SetActive(false); //SetupLevelSpriteScreen(); SetSelectListButton(); names = Input.GetJoystickNames(); for (int x = 0; x < names.Length; x++) { // print(names[x].Length); if (names[x].Length == 33) { // Debug.Log("Xbox 360 Connected"); typeControllerGame = TypeControllerGame.GamePad; } else { typeControllerGame = TypeControllerGame.MouseAndKeyboard; } } }
// Update is called once per frame void Update() { names = Input.GetJoystickNames(); for (int x = 0; x < names.Length; x++) { // print(names[x].Length); if (names[x].Length == 33) { // Debug.Log("Xbox 360 Connected"); typeControllerGame = TypeControllerGame.GamePad; } else { typeControllerGame = TypeControllerGame.MouseAndKeyboard; } } }
// Update is called once per frame void Update() { // Debug.Log("Diem"+ScoreGame.ToString()); //Xu ly diem trong game titleScoreGame.text = CreateStringCharZero(12 - ScoreGame.ToString().Length) + ScoreGame.ToString(); names = Input.GetJoystickNames(); for (int x = 0; x < names.Length; x++) { // print(names[x].Length); if (names[x].Length == 33) { // Debug.Log("Xbox 360 Connected"); typeControllerGame = TypeControllerGame.GamePad; } else { typeControllerGame = TypeControllerGame.MouseAndKeyboard; } } }
void Update() { if (Input.anyKeyDown && gameState == GameState.None) { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) { return; //Do Nothing } Debug.Log("Press Any Key"); gameState = GameState.Play; ImagePressAnyKey.SetActive(false); PanelButtons.SetActive(true); LogoGame.GetComponent <Animator>().SetBool("Move", true); MiddleButtons.GetComponent <Animator>().SetBool("Move", true); RightButtons.GetComponent <Animator>().SetBool("Move", true); } Cursor.SetCursor(cursonTexture, hotspot, cursorMode); names = Input.GetJoystickNames(); for (int x = 0; x < names.Length; x++) { // print(names[x].Length); if (names[x].Length == 33) { //Debug.Log("Xbox 360 Connected"); typeControllerGame = TypeControllerGame.GamePad; } else { typeControllerGame = TypeControllerGame.MouseAndKeyboard; } } //Debug.Log(Input.GetJoystickNames.ge); }
// Update is called once per frame void Update() { // Debug.Log( "So luong enemy"+ GameObject.FindGameObjectsWithTag("enemy").Length); CheckCompleteMissonGame(); typeControllerGame = GameSetting.typeControllerGame; if (typeControllerGame == TypeControllerGame.GamePad) { if (Input.GetKeyDown("joystick button 0") && gameState == GameState.None) { if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1) || Input.GetMouseButtonDown(2)) { return; //Do Nothing } Debug.Log("Press Any Key"); // titleStartGame.SetActive(false); missionBar.GetComponent <Animator>().SetBool("Show", true); missionBar.GetComponent <Animator>().SetBool("Hide", false); healthBar.GetComponent <Animator>().SetBool("Show", true); healthBar.GetComponent <Animator>().SetBool("Hide", false); pauseButton.GetComponent <Animator>().SetBool("Show", true); pauseButton.GetComponent <Animator>().SetBool("Hide", false); titleStartGame.GetComponent <Animator>().SetBool("Show", false); titleStartGame.GetComponent <Animator>().SetBool("Hide", true); // Destroy(titleStartGame); FindObjectOfType <GameManager>().gameState = GameState.Play; } if (gameState == GameState.Play) { listEnemy.GetComponent <ControllerListEnemy>().StartOrCountinueMovingEnemy(); cloudStartGame.gameObject.transform.position = Vector2.MoveTowards(cloudStartGame.gameObject.transform.position, targetmove.position, 8 * Time.deltaTime); } } else if (typeControllerGame == TypeControllerGame.MouseAndKeyboard) { if (Input.GetKeyDown(KeyCode.Space)) { missionBar.GetComponent <Animator>().SetBool("Show", true); missionBar.GetComponent <Animator>().SetBool("Hide", false); healthBar.GetComponent <Animator>().SetBool("Show", true); healthBar.GetComponent <Animator>().SetBool("Hide", false); pauseButton.GetComponent <Animator>().SetBool("Show", true); pauseButton.GetComponent <Animator>().SetBool("Hide", false); titleStartGame.GetComponent <Animator>().SetBool("Show", false); titleStartGame.GetComponent <Animator>().SetBool("Hide", true); FindObjectOfType <GameManager>().gameState = GameState.Play; } if (gameState == GameState.Play) { listEnemy.GetComponent <ControllerListEnemy>().StartOrCountinueMovingEnemy(); cloudStartGame.gameObject.transform.position = Vector2.MoveTowards(cloudStartGame.gameObject.transform.position, targetmove.position, 8 * Time.deltaTime); } } }