Exemple #1
0
        public Target(TargetData targetData, TargetIcon timelineIcon, TargetIcon gridIcon)
        {
            timelineTargetIcon = timelineIcon;
            gridTargetIcon     = gridIcon;

            data = new TargetData();
            data.PositionChangeEvent   += OnGridPositionChanged;
            data.HandTypeChangeEvent   += OnHandTypeChanged;
            data.BeatTimeChangeEvent   += OnBeatTimeChanged;
            data.BeatLengthChangeEvent += OnBeatLengthChanged;

            timelineTargetIcon.Init(data);
            gridTargetIcon.Init(data);

            data.Copy(targetData);
            UpdateTimelineSustainLength();
        }
Exemple #2
0
        public Target(TargetData targetData, TargetIcon timelineIcon, TargetIcon gridIcon, bool transient)
        {
            timelineTargetIcon = timelineIcon;
            gridTargetIcon     = gridIcon;

            data = targetData;
            data.PositionChangeEvent   += OnGridPositionChanged;
            data.HandTypeChangeEvent   += OnHandTypeChanged;
            data.TickChangeEvent       += OnTickChanged;
            data.BeatLengthChangeEvent += OnBeatLengthChanged;

            timelineTargetIcon.Init(this, data);
            gridTargetIcon.Init(this, data);

            //Must be after the two init's, unfortunate timing restiction, but the new objects must be active to find the hold target managers
            data.BehaviourChangeEvent += OnBehaviorChanged;

            UpdateTimelineSustainLength();

            gridTargetIcon.OnTryRemoveEvent     += DeleteNote;
            timelineTargetIcon.OnTryRemoveEvent += DeleteNote;

            gridTargetIcon.IconEnterLoadedNotesEvent += TargetEnterLoadedNotes;
            gridTargetIcon.IconExitLoadedNotesEvent  += TargetExitLoadedNotes;

            timelineTargetIcon.TrySelectEvent += MakeTimelineSelectTarget;
            gridTargetIcon.TrySelectEvent     += MakeTimelineSelectTarget;

            timelineTargetIcon.TryDeselectEvent += MakeTimelineDeselectTarget;
            gridTargetIcon.TryDeselectEvent     += MakeTimelineDeselectTarget;

            SetOutlineColor(NRSettings.config.selectedHighlightColor);

            this.transient = transient;
            if (transient)
            {
                foreach (Renderer r in gridTargetIcon.GetComponentsInChildren <Renderer>(true))
                {
                    if (r.name == "WhiteRing")
                    {
                        var color = r.material.GetColor("_Tint");
                        color.r = 0.1f;
                        color.g = 0.1f;
                        color.b = 0.1f;
                        r.material.SetColor("_Tint", color);
                    }
                }
                foreach (Renderer r in timelineTargetIcon.GetComponentsInChildren <SpriteRenderer>(true))
                {
                    var color = r.material.color;
                    color.r          = 0.5f;
                    color.g          = 0.5f;
                    color.b          = 0.5f;
                    r.material.color = color;
                }
            }

            if (data.behavior == TargetBehavior.NR_Pathbuilder)
            {
                data.pathBuilderData.InitialAngleChangedEvent += UpdatePathInitialAngle;
                data.pathBuilderData.RecalculateEvent         += RecalculatePathbuilderData;
                data.pathBuilderData.RecalculateFinishedEvent += UpdatePath;

                UpdatePathInitialAngle();
            }
        }