public static NoteOrb DuplicateNoteOrb(NoteOrb sourceOrb) { //Create new orb with identical position, rotation, and scale NoteOrb copy = DefaultNoteOrb(sourceOrb.transform.position, sourceOrb.transform.rotation); copy.transform.localScale = sourceOrb.transform.localScale; Object.Destroy(copy.transform.Find("Cores").Find("InitialCore").gameObject); copy.NoteCores.Clear(); copy.SelectedNotes.Clear(); //Copy note cores List <NoteCore> sourceCores = sourceOrb.NoteCores; for (int i = 0; i < sourceCores.Count; i++) { NoteCore coreCopy = DuplicateNoteCore(sourceCores[i]); coreCopy.transform.SetParent(copy.transform); coreCopy.transform.localScale = sourceCores[i].transform.localScale; coreCopy.transform.localPosition = sourceCores[i].transform.localPosition; coreCopy.GetComponent <Scalable>().TargetScale = coreCopy.transform.localScale; copy.NoteCores.Add(coreCopy); } copy.SelectedNotes = new List <int>(sourceOrb.SelectedNotes); copy.GetComponent <VRTK_InteractableObject>().isGrabbable = true; return(copy); }
private static NoteCore DuplicateNoteCore(NoteCore sourceCore) { NoteCore copy = Object.Instantiate(ComposeVRManager.Instance.NoteCorePrefab, sourceCore.transform.position, sourceCore.transform.rotation).GetComponent <NoteCore>(); copy.Color = sourceCore.Color; copy.Note = sourceCore.Note; return(copy); }
void Awake() { output = GetComponentInChildren <PhysicalDataOutput>(); shellTrigger = transform.Find("Shell").GetComponent <SimpleTrigger>(); shellTrigger.TriggerEnter += OnShellTriggerEnter; shellTrigger.TriggerExit += OnShellTriggerExit; Material shellMat = shellTrigger.transform.GetComponent <MeshRenderer>().material; baseShellEmissionGain = shellMat.GetFloat("_EmissionGain"); baseShellColor = shellMat.GetColor("_TintColor"); foreignCores = new Dictionary <NoteOrb, List <NoteCore> >(); coreContainer = transform.Find("Cores"); coreContainerLowerBound = coreContainer.Find("LowerBound"); NoteCore initialCore = coreContainer.Find("InitialCore").GetComponent <NoteCore>(); initialCoreScale = initialCore.transform.localScale; fullCoreScale = new Vector3(FULL_ORB_CORE_RADIUS, FULL_ORB_CORE_RADIUS, FULL_ORB_CORE_RADIUS); noteCores = new List <NoteCore>(); noteCores.Add(initialCore); collidingBatons = new HashSet <Baton>(); selectedNotes = new List <int>(); interactable = GetComponent <VRTK_InteractableObject>(); interactable.InteractableObjectGrabbed += OnGrabbed; interactable.InteractableObjectUngrabbed += OnUngrabbed; miniature = GetComponent <Miniature>(); HMD = GameObject.FindGameObjectWithTag("Headset").transform; noteSelector = FindObjectOfType <NoteSelector>(); defaultSelfDestructArgs = new EventArgs(); previewTriggerEventArgs = new TriggerEventArgs(); previewTriggerEventArgs.Velocity = 95; GetComponent <Triggerable>().TriggerStarted += OrbOn; GetComponent <Triggerable>().TriggerEnded += OrbOff; }
private void SetCoreNote(NoteCore core, int note) { core.Note = note; core.Color = NoteColors.GetNoteColor(note); }