//Remove a holding note protected virtual void RemoveNote() { NoteObject note = GvrPointerInputModule.Pointer.PointerTransform.GetComponentInChildren <NoteObject>(); note.transform.SetParent(null); Destroy(note.GetComponent <PhotonView>()); }
IEnumerator Miss(NoteObject note) { note.GetComponent <Collider2D>().enabled = false; yield return(new WaitForSeconds(2)); note.gameObject.SetActive(false); }
public override void Play() { Note note = new Note { audioClip = source.clip, volume = source.volume }; NoteObject noteObject = InstantiateNoteObject(); spawner.HandleNewNote(noteObject, note); noteObject.GetComponent <PhotonView>().RPC("UpdateNote", PhotonTargets.Others, note.audioClip.name, note.volume, colorNote.r, colorNote.g, colorNote.b); source.Play(); }
public override void HandleNewNote(NoteObject noteObject, Note note) { noteObject.transform.position = PositionNote(NotesHold.Count); noteObject.transform.rotation = transform.rotation; noteObject.transform.SetParent(rail.transform); noteObject.note = note; while (NotesHold.Count >= maxNotes) { NoteObject n = NotesHold[0]; NotesHold.RemoveAt(0); n.gameObject.SetActive(false); n.GetComponent <PhotonView>().RPC("RemoveToSpwaner", PhotonTargets.Others, 0); PhotonView photonView = n.GetComponent <PhotonView>(); if (!photonView.isMine) { photonView.GetComponent <PhotonNoteSynchro>().TransferOwnership(); } PhotonNetwork.Destroy(photonView); } noteObject.GetComponent <PhotonView>().RPC("AddToSpwaner", PhotonTargets.Others); NotesHold.Add(noteObject); }
public virtual void HandleNewNote(NoteObject noteObject, Note note) { noteObject.transform.position = PositionNote(NotesHold.Count); noteObject.transform.rotation = transform.rotation; noteObject.transform.SetParent(rail.transform); noteObject.note = note; while (NotesHold.Count >= maxNotes) { NoteObject n = NotesHold[0]; NotesHold.RemoveAt(0); n.gameObject.SetActive(false); Destroy(n.GetComponent <PhotonView>()); } NotesHold.Add(noteObject); }
public void SpawnVFXOnHit(NoteObject note, Judgement judgement) { // Judgement should never be Break here. if (judgement == Judgement.Miss) { return; } switch (note.note.type) { case NoteType.Basic: case NoteType.ChainHead: case NoteType.ChainNode: // Do nothing. VFX is spawned on resolve. break; case NoteType.Hold: holdNoteToOngoingHeadVfx.Add(note, SpawnPrefabAt(holdOngoingHead, note)); holdNoteToOngoingTrailVfx.Add(note, SpawnPrefabAt(holdOngoingTrail, note)); break; case NoteType.Drag: dragNoteToOngoingVfx.Add(note, SpawnPrefabAt(dragOngoing, note)); break; case NoteType.RepeatHeadHold: holdNoteToOngoingHeadVfx.Add(note, SpawnPrefabAt(repeatHoldOngoingHead, note)); holdNoteToOngoingTrailVfx.Add(note, SpawnPrefabAt(repeatHoldOngoingTrail, note)); break; case NoteType.RepeatHold: // Spawn the head VFX on repeat head. NoteObject repeatHead = note .GetComponent <NoteAppearance>() .GetRepeatHead().GetComponent <NoteObject>(); holdNoteToOngoingHeadVfx.Add(repeatHead, SpawnPrefabAt( repeatHoldOngoingHead, repeatHead)); holdNoteToOngoingTrailVfx.Add(note, SpawnPrefabAt(repeatHoldOngoingTrail, note)); break; } }
IEnumerator Hit(NoteObject note) { note.moving = false; note.GetComponent <Collider2D>().enabled = false; songmanager.hitSound.Play(); var col = note.theSR.color; for (float f = 1f; f >= 0; f -= Time.deltaTime * 2) { note.transform.localScale += new Vector3(Time.deltaTime, Time.deltaTime, 0); col.a = f; note.theSR.color = col; yield return(null); } note.gameObject.SetActive(false); }
public override void HandleNewNote(NoteObject noteObject, Note note) { noteObject.note = note; noteObject.transform.SetParent(spawnPoint.transform); noteObject.transform.localPosition = Vector3.zero; if (NoteHeld != null) { PhotonView photonView = NoteHeld.GetComponent <PhotonView>(); if (!photonView.isMine) { NoteHeld.GetComponent <PhotonNoteSynchro>().TransferOwnership(); } PhotonNetwork.Destroy(NoteHeld.gameObject); } NoteHeld = noteObject; noteObject.GetComponent <PhotonView>().RPC("SetSpawnerHeldNote", PhotonTargets.Others); }
public void Initialize(Scan scanRef, NoteObject noteRef, int lastNotePulse) { this.noteRef = noteRef.GetComponent <NoteAppearance>(); float startX = GetComponent <RectTransform>() .anchoredPosition.x; float endX = scanRef.FloatPulseToXPosition( lastNotePulse, positionEndOfScanOutOfBounds: true, positionAfterScanOutOfBounds: true); float width = Mathf.Abs(startX - endX); extension.sizeDelta = new Vector2(width, extension.sizeDelta.y); if (endX < startX) { extension.localRotation = Quaternion.Euler(0f, 0f, 180f); } }
public void Show(NoteObject n, Judgement judgement) { noteToFollow = n.GetComponent <NoteAppearance>() .noteImage.transform; Follow(); string display = ""; switch (judgement) { case Judgement.RainbowMax: display = "MAX"; break; default: display = judgement.ToString().ToUpper(); break; } if (Game.currentCombo > 0) { display += " " + Game.currentCombo; } if (Game.feverState == Game.FeverState.Active && (judgement == Judgement.RainbowMax || judgement == Judgement.Max)) { text.fontSharedMaterial.SetTexture(ShaderUtilities.ID_FaceTex, null); text.faceColor = feverMaxColor; } else if (judgement == Judgement.RainbowMax && Game.feverState != Game.FeverState.Active) { // https://forum.unity.com/threads/change-textmesh-pro-face-texture-with-script.679912/ text.fontSharedMaterial.SetTexture(ShaderUtilities.ID_FaceTex, rainbowTexture); // Cannot set color: Animator will control that in order // to set alpha. text.faceColor = Color.white; } else { text.fontSharedMaterial.SetTexture(ShaderUtilities.ID_FaceTex, null); switch (judgement) { case Judgement.Max: text.faceColor = maxColor; break; case Judgement.Cool: text.faceColor = coolColor; break; case Judgement.Good: text.faceColor = goodColor; break; case Judgement.Miss: text.faceColor = missColor; break; case Judgement.Break: text.faceColor = breakColor; break; } } text.text = display; animator.SetTrigger("Activate"); }
public void SpawnVFXOnResolve(NoteObject note, Judgement judgement) { // Even if judgement is Miss or Break, we still need // to despawn ongoing VFX, if any. switch (note.note.type) { case NoteType.Basic: case NoteType.ChainHead: case NoteType.ChainNode: switch (judgement) { case Judgement.RainbowMax: case Judgement.Max: SpawnPrefabAt(explosionMax, note); break; case Judgement.Cool: SpawnPrefabAt(explosionCool, note); break; case Judgement.Good: SpawnPrefabAt(explosionGood, note); break; } break; case NoteType.Hold: if (holdNoteToOngoingHeadVfx.ContainsKey(note)) { Destroy(holdNoteToOngoingHeadVfx[note]); holdNoteToOngoingHeadVfx.Remove(note); } if (holdNoteToOngoingTrailVfx.ContainsKey(note)) { Destroy(holdNoteToOngoingTrailVfx[note]); holdNoteToOngoingTrailVfx.Remove(note); } if (judgement != Judgement.Miss && judgement != Judgement.Break) { SpawnPrefabAt(holdComplete, note.GetComponent <NoteAppearance>() .GetDurationTrailEndPosition()); } break; case NoteType.Drag: if (dragNoteToOngoingVfx.ContainsKey(note)) { Destroy(dragNoteToOngoingVfx[note]); dragNoteToOngoingVfx.Remove(note); } if (judgement != Judgement.Miss && judgement != Judgement.Break) { SpawnPrefabAt(dragComplete, note.GetComponent <NoteAppearance>() .GetCurveEndPosition()); } break; case NoteType.RepeatHead: if (judgement == Judgement.Miss || judgement == Judgement.Break) { break; } SpawnPrefabAt(repeatHead, note); break; case NoteType.Repeat: if (judgement == Judgement.Miss || judgement == Judgement.Break) { break; } SpawnPrefabAt(repeatNote, note); SpawnPrefabAt(repeatHead, note.GetComponent <NoteAppearance>() .GetRepeatHead().GetComponent <NoteObject>()); break; case NoteType.RepeatHeadHold: if (holdNoteToOngoingHeadVfx.ContainsKey(note)) { Destroy(holdNoteToOngoingHeadVfx[note]); holdNoteToOngoingHeadVfx.Remove(note); } if (holdNoteToOngoingTrailVfx.ContainsKey(note)) { Destroy(holdNoteToOngoingTrailVfx[note]); holdNoteToOngoingTrailVfx.Remove(note); } if (judgement != Judgement.Miss && judgement != Judgement.Break) { SpawnPrefabAt(repeatHoldComplete, note.GetComponent <NoteAppearance>() .GetDurationTrailEndPosition()); } break; case NoteType.RepeatHold: NoteObject repeatHeadNote = note .GetComponent <NoteAppearance>() .GetRepeatHead().GetComponent <NoteObject>(); if (holdNoteToOngoingHeadVfx .ContainsKey(repeatHeadNote)) { Destroy(holdNoteToOngoingHeadVfx [repeatHeadNote]); holdNoteToOngoingHeadVfx.Remove( repeatHeadNote); } if (holdNoteToOngoingTrailVfx.ContainsKey(note)) { Destroy(holdNoteToOngoingTrailVfx[note]); holdNoteToOngoingTrailVfx.Remove(note); } if (judgement != Judgement.Miss && judgement != Judgement.Break) { SpawnPrefabAt(repeatHoldComplete, note.GetComponent <NoteAppearance>() .GetDurationTrailEndPosition()); } break; } }