// スキル発動処理 void Skill() { if (Input.GetKeyDown(KeyCode.I) || Input.GetButtonDown("ButtonA")) { GameObject laserobj; laserobj = (GameObject)Instantiate(laserrange, transform.position, Quaternion.Euler(0f, 0f, 0f)); laserobj.transform.parent = this.transform; } if ((Input.GetKeyUp(KeyCode.I) || Input.GetButtonUp("ButtonA")) && lasercount <= 0) { Instantiate(laser, transform.position, Quaternion.Euler(0, 0, 0)); characs.Laser_SE(); lasercount = laserDefaultTime; } if (Input.GetKeyDown(KeyCode.O) || Input.GetButtonDown("ButtonX")) { Instantiate(haiturange, haiturange.transform.position, Quaternion.Euler(0f, 0f, 0f)); } if ((Input.GetKeyUp(KeyCode.O) || Input.GetButtonUp("ButtonX")) && haitucount <= 0) { Instantiate(haitu, haitu.transform.position, Quaternion.Euler(0, 0, 0)); characs.haitu_SE(); haitucount = haituDefaultTime; } if ((Input.GetKeyUp(KeyCode.P) || Input.GetButtonUp("ButtonY")) && Clonecount <= 0) { Instantiate(Clone, Clone.transform.position, Quaternion.Euler(0, 0, 0)); Clonecount = cloneDefaultTime; } }
void Update() { //カメラを取得 main = mainCamera.GetComponent <Camera>(); Vector3 mousePos = main.ScreenToWorldPoint(Input.mousePosition); Collider2D col = Physics2D.OverlapPoint(mousePos); //タップ確認 if (Input.GetMouseButtonDown(0)) { if (col == Button.GetComponent <Collider2D>()) { //タップされた時の処理 if (player.lasercount >= 5) { Instantiate(player.laser, player.transform.position, Quaternion.Euler(0, 0, 0)); chara.Laser_SE(); player.lasercount = 0; } } } }