예제 #1
0
        public static ChordSlot Instantiate(ChordSlot prefab,
                                            Transform parent, Vector3 localPosition, DraggableChord chordPrefab, ChordEditor chordEditor)
        {
            ChordSlot instance = Instantiate(prefab, parent);

            instance.transform.localPosition = Helpers.ReplaceZ(localPosition, -0.1f);
            instance.chordPrefab             = chordPrefab;
            instance.editor = chordEditor;

            instance.camera = Camera.main;

            instance.isProperlyInstantiated = true;
            return(instance);
        }
예제 #2
0
        private void InstantiateSlots()
        {
            if (ChordsUpdated == null)
            {
                ChordsUpdated = new ChordAttachedToSlotEvent();
            }

            slots = new List <ChordSlot>();

            for (int i = bounds.xMin; i < bounds.xMax; ++i)
            {
                ChordSlot slot = ChordSlot.Instantiate(data.ChordSlotPrefab,
                                                       grid.transform,
                                                       grid.GetCellCenterLocal(new Vector3Int(i, 0, 0)),
                                                       data.ChordPrefab,
                                                       this);
                slot.ChordAttached.AddListener(ChordsUpdated.Invoke);
                slots.Add(slot);
            }
        }