private void checkHyperDashCatcherColour(ISkin skin, Color4 expectedCatcherColour, Color4?expectedEndGlowColour = null)
        {
            CatcherArea         catcherArea = null;
            CatcherTrailDisplay trails      = null;

            AddStep("create hyper-dashing catcher", () =>
            {
                Child = setupSkinHierarchy(catcherArea = new CatcherArea
                {
                    Anchor = Anchor.Centre,
                    Origin = Anchor.Centre,
                    Scale  = new Vector2(4f),
                }, skin);
            });

            AddStep("get trails container", () =>
            {
                trails = catcherArea.OfType <CatcherTrailDisplay>().Single();
                catcherArea.MovableCatcher.SetHyperDashState(2);
            });

            AddUntilStep("catcher colour is correct", () => catcherArea.MovableCatcher.Colour == expectedCatcherColour);

            AddAssert("catcher trails colours are correct", () => trails.HyperDashTrailsColour == expectedCatcherColour);
            AddAssert("catcher end-glow colours are correct", () => trails.EndGlowSpritesColour == (expectedEndGlowColour ?? expectedCatcherColour));

            AddStep("finish hyper-dashing", () =>
            {
                catcherArea.MovableCatcher.SetHyperDashState(1);
                catcherArea.MovableCatcher.FinishTransforms();
            });

            AddAssert("catcher colour returned to white", () => catcherArea.MovableCatcher.Colour == Color4.White);
        }
Ejemplo n.º 2
0
        private void initialiseHyperDash(List <CatchHitObject> objects)
        {
            List <CatchHitObject> objectWithDroplets = new List <CatchHitObject>();

            foreach (var currentObject in objects)
            {
                if (currentObject is Fruit)
                {
                    objectWithDroplets.Add(currentObject);
                }

                if (currentObject is JuiceStream)
                {
                    foreach (var currentJuiceElement in currentObject.NestedHitObjects)
                    {
                        if (!(currentJuiceElement is TinyDroplet))
                        {
                            objectWithDroplets.Add((CatchHitObject)currentJuiceElement);
                        }
                    }
                }
            }

            objectWithDroplets.Sort((h1, h2) => h1.StartTime.CompareTo(h2.StartTime));

            double halfCatcherWidth = CatcherArea.GetCatcherSize(Beatmap.BeatmapInfo.BaseDifficulty) / 2;
            int    lastDirection    = 0;
            double lastExcess       = halfCatcherWidth;

            for (int i = 0; i < objectWithDroplets.Count - 1; i++)
            {
                CatchHitObject currentObject = objectWithDroplets[i];
                CatchHitObject nextObject    = objectWithDroplets[i + 1];

                int    thisDirection   = nextObject.X > currentObject.X ? 1 : -1;
                double timeToNext      = nextObject.StartTime - currentObject.StartTime - 1000f / 60f / 4; // 1/4th of a frame of grace time, taken from osu-stable
                double distanceToNext  = Math.Abs(nextObject.X - currentObject.X) - (lastDirection == thisDirection ? lastExcess : halfCatcherWidth);
                float  distanceToHyper = (float)(timeToNext * CatcherArea.Catcher.BASE_SPEED - distanceToNext);

                if (distanceToHyper < 0)
                {
                    currentObject.HyperDashTarget = nextObject;
                    lastExcess = halfCatcherWidth;
                }
                else
                {
                    currentObject.DistanceToHyperDash = distanceToHyper;
                    lastExcess = Math.Clamp(distanceToHyper, 0, halfCatcherWidth);
                }

                lastDirection = thisDirection;
            }
        }
Ejemplo n.º 3
0
        private void checkHyperDashCatcherColour(ISkin skin, Color4 expectedCatcherColour, Color4?expectedAfterImageColour = null)
        {
            CatcherTrailDisplay trails  = null;
            Catcher             catcher = null;

            AddStep("create hyper-dashing catcher", () =>
            {
                CatcherArea catcherArea;
                Child = setupSkinHierarchy(new Container
                {
                    Anchor = Anchor.Centre,
                    Child  = catcherArea = new CatcherArea
                    {
                        Catcher = catcher = new Catcher(new DroppedObjectContainer())
                        {
                            Scale = new Vector2(4)
                        }
                    }
                }, skin);
                trails = catcherArea.ChildrenOfType <CatcherTrailDisplay>().Single();
            });

            AddStep("start hyper-dash", () =>
            {
                catcher.SetHyperDashState(2);
            });

            AddUntilStep("catcher colour is correct", () => catcher.Colour == expectedCatcherColour);

            AddAssert("catcher trails colours are correct", () => trails.HyperDashTrailsColour == expectedCatcherColour);
            AddAssert("catcher after-image colours are correct", () => trails.HyperDashAfterImageColour == (expectedAfterImageColour ?? expectedCatcherColour));

            AddStep("finish hyper-dashing", () =>
            {
                catcher.SetHyperDashState();
                catcher.FinishTransforms();
            });

            AddAssert("catcher colour returned to white", () => catcher.Colour == Color4.White);
        }
Ejemplo n.º 4
0
 public MouseInputHelper(CatchPlayfield playfield)
 {
     catcherArea      = playfield.CatcherArea;
     RelativeSizeAxes = Axes.Both;
 }