void InitiateEvent(InteractableStateArgs state) { if (state.NewInteractableState == InteractableState.ActionState) { if (timer.GetComponent <timer>().timeGetter() == 60) { timer.GetComponent <timer>().StartTimer(); textBox.GetComponent <PatternController>().generatingCombo(); } if (curCombo[curPunching] == punchingDetect(state)) { //TODO: swap back here //ModelController.MC.recoverOriginalModel(); textBox.transform.GetChild(curPunching).gameObject.SetActive(false); curPunching++; } if (curPunching == numOfPunching) { numOfPunching = -1; curPunching = 0; Array.Clear(curCombo, 0, curCombo.Length); score++; //ModelController.MC.instantiateModel(7); text.text = "Score: " + score.ToString(); textBox.GetComponent <PatternController>().generatingCombo(); } } else { defaultEvent.Invoke(); } //anim.SetBool("isPunched", false); }
/// <summary> /// Paintモードに変更 /// </summary> /// <param name="obj">リスナー登録時に必要な引数</param> private void modeChangeToPaint(InteractableStateArgs obj) { if (obj.NewInteractableState == InteractableState.ActionState) { _paintFunctionState = HpPaintFunctionState.Paint; } }
public void OnExplodeAll(InteractableStateArgs obj) { if (obj.NewInteractableState == InteractableState.ActionState) { _mMainManager.ChangeCurrentAssemblyPosition(_mMainManager.NoOfAssemblies); } }
public void Transport(InteractableStateArgs args) { if (args.NewInteractableState == InteractableState.ContactState) { materialMesh.enabled = true; //material.SetColor("_Color", activeColor); } if (args.NewInteractableState == InteractableState.ProximityState) { //material.SetColor("_Color", activeColor); materialMesh.enabled = true; } if (args.NewInteractableState == InteractableState.Default) { //material.SetColor("_Color", disabledColor); materialMesh.enabled = false; } if (args.NewInteractableState == InteractableState.ActionState) { source.position = target.position; //material.SetColor("_Color", disabledColor); materialMesh.enabled = false; } }
void InitiateEvent(InteractableStateArgs state) { if (state.NewInteractableState == InteractableState.ActionState) { StartCoroutine(BagBouncing(state)); } else { defaultEvent.Invoke(); } }
private int punchingDetect(InteractableStateArgs state) { float x = System.Math.Abs(state.Tool.Velocity.x); float y = System.Math.Abs(state.Tool.Velocity.y); float z = System.Math.Abs(state.Tool.Velocity.z); if (z > x && z > y) { if (state.Tool.IsRightHandedTool) { StartCoroutine(BagBouncing(2)); return(2); } else { StartCoroutine(BagBouncing(1)); return(1); } } else if (x > y && x > z) { if (state.Tool.IsRightHandedTool) { StartCoroutine(BagBouncing(4)); return(4); } else { StartCoroutine(BagBouncing(3)); return(3); } } else { if (state.Tool.IsRightHandedTool) { StartCoroutine(BagBouncing(6)); return(6); } else { StartCoroutine(BagBouncing(5)); return(5); } } }
void InitialEvent(InteractableStateArgs state) { //print(state.Interactable); if (state.NewInteractableState == InteractableState.ProximityState) { //boxtrigger = true; } else if (state.NewInteractableState == InteractableState.ContactState) { boxtrigger = true; } else if (state.NewInteractableState == InteractableState.ActionState) { } else { boxtrigger = false; } }
void InitiateEvent(InteractableStateArgs state) { if (state.NewInteractableState == InteractableState.ProximityState) { proximityEvent.Invoke(); } else if (state.NewInteractableState == InteractableState.ContactState) { contactEvent.Invoke(); } else if (state.NewInteractableState == InteractableState.ActionState) { actionEvent.Invoke(); } else { defaultEvent.Invoke(); } }
// Update is called once per frame IEnumerator BagBouncing(InteractableStateArgs state) { punchingNumber = punchingDetect(state); float x = System.Math.Abs(state.Tool.InteractionPosition.x); float y = System.Math.Abs(state.Tool.InteractionPosition.y); if (curCombo < combos.Length) { if (combos[curCombo][curPunching] == numberDetect(x, y)) { punchingBag.GetComponent <Renderer>().material = bagMaterials[7]; curPunching++; comboName.text = instructions[curCombo]; } else { curPunching = 0; punchingBag.GetComponent <Renderer>().material = bagMaterials[8]; comboName.text = "Wrong Punch!" + Environment.NewLine + "Restart combo!"; } if (curPunching == combos[curCombo].Length) { curPunching = 0; curCombo++; if (curCombo < combos.Length) { comboName.text = instructions[curCombo]; } else { comboName.text = "Nice Job!"; } } } switch (punchingNumber) { case 1: anim.SetBool("jab", true); ac.PlayOneShot(audios[0], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("jab", false); break; case 2: anim.SetBool("cross", true); ac.PlayOneShot(audios[0], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("cross", false); break; case 3: anim.SetBool("hook", true); ac.PlayOneShot(audios[1], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("hook", false); break; case 4: anim.SetBool("hook", true); ac.PlayOneShot(audios[2], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("hook", false); break; case 5: anim.SetBool("uppercut", true); ac.PlayOneShot(audios[3], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("uppercut", false); break; case 6: anim.SetBool("uppercut", true); ac.PlayOneShot(audios[3], 1.0f); yield return(new WaitForSeconds(0.2f)); anim.SetBool("uppercut", false); break; default: break; } if (curCombo < combos.Length - 1) { punchingBag.GetComponent <Renderer>().material = bagMaterials[combos[curCombo][curPunching]]; } else { punchingBag.GetComponent <Renderer>().material = bagMaterials[0]; } }