public AABBDynamicDataNode(ValueObserver <BoundingBox> myBox, SimpleAABBTree myTree, IDynamicObject myData)
 {
     Owner          = myTree;
     this.Data      = myData;
     myInternalItem = myBox;
     myInternalItem.AddObserver(HasChangedValue);
 }
        void Start()
        {
            var teamChangedHandler = new ValueObserver <IList <TeamMember> >(
                nextEventHandler: TeamMembersChangedEvent);
            var observableTeam = this.team.AsObservable;

            this.observableTeamSubscription = observableTeam
                                              .Subscribe(teamChangedHandler);
        }
Exemple #3
0
    public virtual void Insert(IDynamicObject input)
    {
        if (IsReadonly)
        {
            throw new Exception("Someone was either stuck processing or didn't properly dispose of Enumerator for AABBTree.");
        }
        ValueObserver <BoundingBox> Bounds = input.Bounds;
        IAABBNode myNewNode = new AABBDynamicDataNode(Bounds, this, input);

        DynamicNodeLookup.Add(input, myNewNode);
        Insert(myNewNode);
    }
        protected void Start()
        {
            if (this.team == null)
            {
                this.team = GetComponent <TeamMember>().team;
            }
            this.teamColor = team.GetComponent <TeamColor>();
            ErrorIfNoTeamColor();
            var handler = new ValueObserver <Color>(
                nextEventHandler: UpdateColor);

            this.subscription = teamColor.AsObservable.Subscribe(handler);
            UpdateColor(teamColor.Color);
        }
Exemple #5
0
 void Awake()
 {
     hpObserver = new ValueObserver <int>(
         nextEventHandler: PrintValue);
 }
Exemple #6
0
        void HandleHitObject()
        {
            var hitObjs = BaseBeatmap.HitObjects;

            foreach (var hitObject in hitObjs)
            {
                CatchHitObject catchHitObject;
                if (hitObject.HitObjectType == HitObjectTypes.Spinner || hitObject.HitObjectType == HitObjectTypes.BananaShower)
                {
                    continue;
                }
                if (hitObject.HitObjectType == HitObjectTypes.Slider || hitObject.HitObjectType == HitObjectTypes.JuiceStream)
                {
                    dynamic j;
                    if (hitObject is JuiceStream stream)
                    {
                        j = stream;
                    }
                    else
                    {
                        j = hitObject as Slider;
                    }
                    double repeat = j?.RepeatTime ?? throw new InvalidOperationException();
                    double pLen   = j.Length;
                    var    tmPt   = GetAllTimePoints(hitObject.Offset);
                    ValueObserver <double> tickDistance = ValueObserver <double> .FromValue((100 * BaseBeatmap.SliderMultiplier) / BaseBeatmap.SliderTickRate);

                    if (BaseBeatmap.BeatmapVersion >= 8)
                    {
                        tickDistance /= (MathUtlity.Clamp(-1 * tmPt[CatchTimePointType.RawSpm], 10, 1000) / 100);
                    }
                    var curvePoints = new List <OsuPixel>(j.CurvePoints);

                    var sliderType = j.CurveType;
                    if (BaseBeatmap.BeatmapVersion <= 6 && curvePoints.Count >= 2)
                    {
                        if (sliderType == CurveTypes.Linear)
                        {
                            sliderType = CurveTypes.Bezier;
                        }
                    }
                    if (curvePoints.Count == 2)
                    {
                        if (Math.Abs((int)(j.Position.x) - curvePoints[0].x) == 0 && Math.Abs((int)(j.Position.y) - curvePoints[0].y) == 0 ||
                            (Math.Abs(curvePoints[0].x - curvePoints[1].x) == 0 && Math.Abs(curvePoints[0].y - curvePoints[1].y) == 0))
                        {
                            curvePoints.RemoveAt(0);
                            sliderType = CurveTypes.Linear;
                        }
                    }

                    j.curvePoints = curvePoints;

                    j.CurveType    = sliderType;
                    catchHitObject = curvePoints.Count == 0 ? new CatchHitObject(hitObject) : new CatchHitObject(hitObject, tmPt, Difficulty, tickDistance);
                }
                else
                {
                    catchHitObject = new CatchHitObject(hitObject);
                }
                CatchHitObjects.Add(catchHitObject);
                MaxCombo += catchHitObject.GetCombo();
            }
        }