void Start() { trainMetronome = SoundM.CreateSoundInstance("TrainMetronome", transform, GetComponent <Rigidbody>()); rhythm = SoundM.CreateSoundInstance("Forest", transform, GetComponent <Rigidbody>()); SoundM.PlaySound(trainMetronome); SoundM.PlaySound(rhythm); SoundM.SetSoundParameter("TrackVolume", 1); }
public void Hit(int hand) { if (audioManager.checkBeatHit(hand)) { if (streakCounter == 0) { streakTimer = streakLength; } SoundM.PlaySound(poof, handObject[hand].transform.position); streakCounter++; //Debug.Log("hit streak: " + streakCounter); handObject[hand].GetComponentInChildren <ParticleSystem>().Play(); } /*else if (!audioManager.checkBeatHit(hand)) * { * streakCounter == 0; * }*/ }
void InitBlock(int temp) // 비활성화 된 블럭들의 blockNum값을 조절 { int blockNum = sBlock[temp].GetBlockNum(); //터치된 블럭의 blockNum값 for (int i = 0; i < 7; i++) { if (!gBlock[i].activeInHierarchy) //비활성화 상태일 때 { sBlock[i].SetBlockNum(10); } else if (gBlock[i].activeInHierarchy && sBlock[i].GetBlockNum() > blockNum) //현재 체인이 연결된 제일 왼쪽 블럭보다 blockNum 값이 크면 { sBlock[i].SetBlockNum(sBlock[i].GetBlockNum() - chainCount); sBlock[i].MoveBlock(); //블럭 이동 } } GameData.skillPower = chainCount; //체인 갯수 soundM.PlaySound(chainCount - 1); ScoreManager.PlusChainScore(chainCount); chainCount = 0; //체인 카운트 초기화 GameData.touchBlock = null; //터치 상태 = 터치되지 않음 }
IEnumerator Attack() { while (life) { switch (jelly.jellyKind) { case (int)Monster.Normal: animator.Play("NJellyAttack"); effect.Play("NJellyAttackEft"); catstatus.Attacked(jelly.damage); break; case (int)Monster.Strong: animator.Play("StrongJellyAttack"); effect.Play("SJellyAttackEft"); yield return(new WaitForSeconds(0.7f)); // 젤리 공격 애니메이션과 고양이 피격 타이밍 조절 catstatus.Attacked(jelly.damage); break; case (int)Monster.Big: animator.Play("BJellyAttack"); effect.Play("BJellyAttackEft"); catstatus.Attacked(jelly.damage); break; case (int)Monster.Bomb: animator.Play("BombJellyAttack"); effect.Play("BombJellyAttackEft"); yield return(new WaitForSeconds(0.7f)); catstatus.Attacked(jelly.damage); break; } eftSound.PlaySound(jelly.jellyKind); yield return(new WaitForSeconds(3.0f)); } yield break; }
// Update is called once per frame void Update() { Vector3 handVel; Vector3 handAngVel; for (int hand = 0; hand < handObject.Length; hand++) { handObject[hand].GetComponent <Hand>().GetEstimatedPeakVelocities(out handVel, out handAngVel); if (handVel.magnitude > 1f) { handObject[hand].GetComponent <Collider>().enabled = true; } else { handObject[hand].GetComponent <Collider>().enabled = false; } } if (consecutiveMisses > missAllowance) { //reset streak timer and counters consecutiveMisses = 0; streakCounter = 0; streakTimer = -1; } if (streakTimer > 0) { streakTimer -= Time.deltaTime; } else if (streakTimer != -1) { if (audioManager.rhythmIndex < audioManager.rightHandRhythms.Count - 1) { audioManager.rhythmIndex++; streakTimer = -1; streakCounter = 0; transitionTimer = transitionTimerLength; SoundM.PlaySound(transition, transform.position); } } SoundM.UpdateSoundPos(transition, transform.position); //increase focus based on streak timer if (streakTimer >= 0 && consecutiveMisses == 0) { focus = Mathf.Clamp(1 / streakLength * (streakLength - streakTimer) * 1.5f, 0, 1); } else { focus = 0; } if (transitionTimer > 0) { transitionTimer -= Time.deltaTime; } else { transitionTimer = 0; } if (transitionTimer > 0) { //during transition make steam invisible steamAlpha += (0 - steamAlpha) * 0.01f; } else { //adjust steam alpha based of level of focus steamAlpha += (Mathf.Clamp(0.2f - (Mathf.Max(focus - 0.6f, 0) * 2), 0f, 1) - steamAlpha) * 0.01f; } trainSteamController.steamAlpha = steamAlpha; if (Input.GetButtonDown("Fire1")) { fallbackLeftHand.SetActive(true); //Hit(0); Invoke("DisableFallbackHands", 0.2f); } if (Input.GetButtonDown("Fire2")) { fallbackRightHand.SetActive(true); //Hit(1); Invoke("DisableFallbackHands", 0.2f); } }
public void ClickOnButton() { SoundM.PlaySound(0); tab.OpenTab(this.name); }