// Update is called once per frame void Update() { if (InputManager_JHW.LTouchHandleOn() && InputManager_JHW.LTriggerOn()) { LHandAni.Play("Fist"); } else if (InputManager_JHW.LTouchHandleOn()) { LHandAni.Play("restDown"); } else if (InputManager_JHW.LTriggerOn()) { LHandAni.Play("IndexFingerDown"); } else { LHandAni.Play("Idle"); } if (InputManager_JHW.RTouchHandleOn() && InputManager_JHW.RTriggerOn()) { RHandAni.Play("Fist"); } else if (InputManager_JHW.RTouchHandleOn()) { RHandAni.Play("restDown"); } else if (InputManager_JHW.RTriggerOn()) { RHandAni.Play("IndexFingerDown"); } else { RHandAni.Play("Idle"); } }
// Update is called once per frame void Update() { timer += Time.deltaTime; //skill이 성립되었을경우 1초간 보여준다. if (skillon == true) { skill_timer += Time.deltaTime; if (skill_timer > 1.0f) { skill_timer = 0.0f; skillon = false; } } else { //마우스 클릭시 //if (touchOn == false && InputManager_JHW.AButton()) if (InputManager_JHW.RTriggerOn() && touchOn == false) { if (Mystate.GetMyState() == PlayerState.State.Nomal || Mystate.GetMyState() == PlayerState.State.Drawing) { Mystate.SetMyState(PlayerState.State.Drawing); //skill 오브젝트를 좌표에 맞게 생성한다. raser.gameObject.SetActive(true); Vector3 pos = raser.transform.position; pos += raser.transform.forward * .1f; Skills[mySkills[mytype]].transform.position = pos; //Skills[mySkills[mytype]].transform.rotation = transform.rotation; Skills[mySkills[mytype]].transform.rotation = Camera.main.transform.rotation; Skills[mySkills[mytype]].gameObject.SetActive(true); touchOn = true; } } else if (touchOn == true && !InputManager_JHW.RTriggerOn()) { raser.gameObject.SetActive(false); touchOn = false; Skills[mySkills[mytype]].SkillOn(); Mystate.SetMyState(PlayerState.State.Nomal); } if (InputManager_JHW.LTriggerOn() && Mystate.GetMyState() == PlayerState.State.Drawing) { raser.gameObject.SetActive(false); touchOn = false; Skills[mySkills[mytype]].SkillOn(); Mystate.SetMyState(PlayerState.State.Nomal); } } }
private void Update() { if (InputManager_JHW.AButtonDown()) { source.clip = clips[0]; source.Play(); if (!confirm) { SelectMenu = index; confirm = true; player.StartCoroutine(Viberation.ViberationCoroutine(0.2f, 0.3f, OVRInput.Controller.RTouch)); player.StartCoroutine(Viberation.ViberationCoroutine(0.2f, 0.3f, OVRInput.Controller.LTouch)); ui_arr[SelectMenu].GetComponent <Image>().color = new Color(1, 0, 1); Menus[SelectMenu].transform.Translate(0, 0, -10); Menus[SelectMenu].transform.LookAt(Camera.main.transform); Menus[SelectMenu].transform.Rotate(0, 180, 0); } } if (InputManager_JHW.BButtonDown()) { source.clip = clips[1]; source.Play(); if (confirm && SelectMenu >= 0) { Menus[SelectMenu].transform.rotation = Quaternion.identity; Menus[SelectMenu].transform.Translate(0, 0, 10); ui_arr[SelectMenu].GetComponent <Image>().color = new Color(1, 1, 1); SelectMenu = -1; confirm = false; player.StartCoroutine(Viberation.ViberationCoroutine(0.1f, 0.1f, OVRInput.Controller.RTouch)); player.StartCoroutine(Viberation.ViberationCoroutine(0.1f, 0.1f, OVRInput.Controller.LTouch)); } } if (InputManager_JHW.RTriggerOn() && InputManager_JHW.LTriggerOn()) { //준비 완료되었냐고 물어보는 거 확인후!! source.clip = clips[0]; source.Play(); confirm = true; GameStart.gameObject.SetActive(true); // } }
// Update is called once per frame void Update() { if (InputManager_JHW.LTriggerOn() && InputManager_JHW.RTriggerOn()) { if (MyState.GetMyState() == PlayerState.State.Nomal) { MyState.SetMyState(PlayerState.State.Attack); if (currentCorutine == null) { flug = true; switch (LineDraw.curType) { case 0: //아즈라 공격 형태 기를 모으는 형태, 오큘러스 터치의 충돌에서 출발하여 양손을 벌릴때 점차 커지며 방출 { currentCorutine = StartCoroutine(AzuraControll()); } break; case 1: // 화살의 형태 화살을 장전한채로 트리거를 누르고 있을 시 기를 모아 방출 { currentCorutine = StartCoroutine(SeikwanControll()); } break; case 2: //전격 공격, 총알 발사 형태, 몬스터를 타겟하여 전격을 발사 형태, 저격 된 상태에서 기를 모아 방출 { currentCorutine = StartCoroutine(BeejaeControll()); } break; case 3: // 양 컨트롤러의 포인터가 맞춰졌을대 발동, 트리거를 계속 on하면 기를 모아 방출 베르베시 { currentCorutine = StartCoroutine(VerbaseControll()); } break; case 4: //바이올린 상태 전체 공격 위주, 한정된 시간에 여러번 좌우 이동을 통해 차징 공격 { currentCorutine = StartCoroutine(DellControll()); } break; } } } } else if ((!InputManager_JHW.RTriggerOn() && !InputManager_JHW.LTriggerOn()) && flug) { flug = false; MyState.SetMyState(PlayerState.State.Nomal); SettingOff(); } if (MyState.GetMyState() == PlayerState.State.ChargingOver) { SettingOff(); } if (LineDraw.curType == 1) { for (int i = 0; i < Arrow.Length; ++i) { if (Arrow[i]) { if (Arrow[i].GetComponent <SeiKwanSkill>().IsDelete()) { Arrow[i].GetComponent <SeiKwanSkill>().resetDelete(); Arrowpool.RemoveItem(Arrow[i]); Arrow[i] = null; } //어떤 조건에 의거 Arrow삭제 } } } else if (LineDraw.curType == 0) { for (int i = 0; i < AzuraBall.Length; ++i) { if (AzuraBall[i]) { if (AzuraBall[i].GetComponent <AzuraSkill>().IsDelete()) { AzuraBall[i].GetComponent <AzuraSkill>().resetDelete(); Azurapool.RemoveItem(AzuraBall[i]); AzuraBall[i] = null; } //어떤 조건에 의거 AzuraBall삭제 } } } }
private IEnumerator SeikwanControll() { bool instance = false; float distance = 0.0f; Vector3 Seikwan = ArrowPrefab.transform.localScale; int ArrowNum = new int(); while (flug) { if (!instance && (AzuraHands[0].GetTouch() || AzuraHands[1].GetTouch()) && (InputManager_JHW.LTriggerOn() && InputManager_JHW.RTriggerOn())) { instance = true; for (int i = 0; i < Arrow.Length; ++i) { if (Arrow[i] == null) { ArrowNum = i; Arrow[i] = Arrowpool.NewItem(); Arrow[i].transform.position = Hands[0].transform.position; Rigidbody r = Arrow[i].GetComponent <Rigidbody>(); r.useGravity = false; r.velocity = new Vector3(0, 0, 0); break; } //5발 다쏘고 난다음도 생각해야함 } MyState.SetMyState(PlayerState.State.Charging, typecheck.Skills[1].GetSkillChargingTime()); } else if (instance) { float handDis = Vector3.Distance(Hands[0].transform.position, Hands[1].transform.position); if ((!InputManager_JHW.RTriggerOn() && InputManager_JHW.LTriggerOn())) { if (!Arrow[ArrowNum].GetComponent <SeiKwanSkill>().IsShoot()) { //Rigidbody r = Arrow[ArrowNum].GetComponent<Rigidbody>(); //Vector3 Arrowforward = Arrow[ArrowNum].transform.forward; GameObject myTarget = PlayerTarget.getMytarget(); //Vector3 TargettingDir = Vector3.zero; if (myTarget != null) { playerSound.PlayerSound(PlayerSoundSetting.soundPack.AttackSkill); Arrow[ArrowNum].GetComponent <SeiKwanSkill>().shoot(typecheck.Skills[1].getCurrentSkill(), myTarget, handDis); } else { if (typecheck.Skills[1].getCurrentSkill() == 1) { playerSound.PlayerSound(PlayerSoundSetting.soundPack.AttackSkill); Arrow[ArrowNum].GetComponent <SeiKwanSkill>().shoot(typecheck.Skills[1].getCurrentSkill(), myTarget, handDis); } else { Arrow[ArrowNum].GetComponent <SeiKwanSkill>().resetDelete(); Arrowpool.RemoveItem(Arrow[ArrowNum]); Arrow[ArrowNum] = null; } } instance = false; distance = 0.0f; MyState.CharginTimeReset(); } Debug.Log(Hands[0].transform.position); } else { Vector3 ArrowPos = (Hands[0].transform.position + Hands[1].transform.position) / 2; Vector3 LookAtpos = Hands[0].transform.position; if (!MyState.IsBack()) { if (Hands[0].transform.localPosition.x < 0) { LookAtpos.z -= 0.06f; } else { LookAtpos.z += 0.06f; } } else { Debug.Log(Hands[0].transform.localPosition.x); if (Hands[0].transform.localPosition.x < 0) { LookAtpos.z += 0.06f; } else { LookAtpos.z -= 0.06f; } } ArrowPos += Hands[0].transform.forward * 0.05f; Arrow[ArrowNum].transform.LookAt(LookAtpos); Arrow[ArrowNum].transform.position = ArrowPos; if (handDis > distance) { distance = handDis; Seikwan.z = distance * 10; Arrow[ArrowNum].transform.localScale = Seikwan; } } } yield return(new WaitForSeconds(0.03f)); } }
private IEnumerator SeikwanControll() { bool instance = false; float distance = 0.0f; Vector3 Seikwan = ArrowPrefab.transform.localScale; int ArrowNum = new int(); while (flug) { if (!instance && (AzuraHands[0].GetTouch() || AzuraHands[1].GetTouch()) && (InputManager_JHW.LTriggerOn() && InputManager_JHW.RTriggerOn())) { instance = true; for (int i = 0; i < Arrow.Length; ++i) { if (Arrow[i] == null) { ArrowNum = i; Arrow[i] = Arrowpool.NewItem(); Arrow[i].transform.position = Hands[0].transform.position; Rigidbody r = Arrow[i].GetComponent <Rigidbody>(); Arrow[i].GetComponent <Arrow>().setDelTime(2.0f); r.useGravity = false; r.velocity = new Vector3(0, 0, 0); break; } //5발 다쏘고 난다음도 생각해야함 } MyState.SetMyState(PlayerState.State.Charging, typecheck.Skills[1].GetSkillChargingTime()); } else if (instance) { float handDis = Vector3.Distance(Hands[0].transform.position, Hands[1].transform.position); if ((!InputManager_JHW.RTriggerOn() && InputManager_JHW.LTriggerOn())) { if (!Arrow[ArrowNum].GetComponent <Arrow>().IsShooting()) { Rigidbody r = Arrow[ArrowNum].GetComponent <Rigidbody>(); Vector3 Arrowforward = Arrow[ArrowNum].transform.forward; GameObject myTarget = PlayerTarget.getMytarget(); Vector3 TargettingDir = Vector3.zero; if (myTarget != null) { TargettingDir = Vector3.Normalize(myTarget.transform.position - Arrow[ArrowNum].transform.position); //; } //Debug.Log(Vector3.Dot(TargettingDir, Arrowforward)); if (Vector3.Dot(TargettingDir, Arrowforward) < 0.8f || TargettingDir == Vector3.zero) { r.velocity = Arrowforward * 15f * handDis; } else { TargettingDir += Arrowforward; r.velocity = TargettingDir * 15f * handDis; } Arrow[ArrowNum].GetComponent <Arrow>().Shooting(true); instance = false; distance = 0.0f; MyState.CharginTimeReset(); } Debug.Log(Hands[0].transform.position); } else { Vector3 ArrowPos = (Hands[0].transform.position + Hands[1].transform.position) / 2; Vector3 LookAtpos = Hands[0].transform.position; if (!MyState.IsBack()) { if (Hands[0].transform.localPosition.x < 0) { LookAtpos.z -= 0.06f; } else { LookAtpos.z += 0.06f; } } else { Debug.Log(Hands[0].transform.localPosition.x); if (Hands[0].transform.localPosition.x < 0) { LookAtpos.z += 0.06f; } else { LookAtpos.z -= 0.06f; } } ArrowPos += Hands[0].transform.forward * 0.05f; Arrow[ArrowNum].transform.LookAt(LookAtpos); Arrow[ArrowNum].transform.position = ArrowPos; if (handDis > distance) { distance = handDis; Seikwan.z = distance * 10; Arrow[ArrowNum].transform.localScale = Seikwan; } } } yield return(new WaitForSeconds(0.03f)); } }