Example #1
0
        protected override bool CollidedWithPlayer(BosuPlayer player)
        {
            // Let's assume that player is a circle for simplicity

            var playerPosition = player.PlayerPositionInPlayfieldSpace();
            var distance       = Math.Sqrt(Math.Pow(Math.Abs(playerPosition.X - Position.X), 2) + Math.Pow(Math.Abs(playerPosition.Y - Position.Y), 2));
            var playerRadius   = player.PlayerDrawSize().X / 2f;
            var cherryRadius   = finalSize / 2f;

            if (distance < playerRadius + cherryRadius)
            {
                return(true);
            }

            return(false);
        }
Example #2
0
 public BosuPlayfield()
 {
     InternalChildren = new Drawable[]
     {
         new BosuBackground(),
         new Container
         {
             RelativeSizeAxes = Axes.Both,
             Masking          = true,
             Children         = new Drawable[]
             {
                 HitObjectContainer,
                 Player = new BosuPlayer()
             }
         }
     };
 }
Example #3
0
 public BosuPlayfield()
 {
     Origin           = Anchor.Centre;
     Anchor           = Anchor.Centre;
     Masking          = true;
     InternalChildren = new Drawable[]
     {
         bg = new PlayfieldBackground(),
         new Container
         {
             RelativeSizeAxes = Axes.Both,
             Child            = HitObjectContainer
         },
         new BosuPlayfieldBorder(),
         Player          = new BosuPlayer(),
         enteringOverlay = new EnteringOverlay
         {
             Alpha = UseEnteringAnimation ? 1 : 0
         },
         deathOverlay = new DeathOverlay()
     };
 }
Example #4
0
 protected abstract bool CollidedWithPlayer(BosuPlayer player);
Example #5
0
 public void GetPlayerToTrace(BosuPlayer player) => Player = player;
 protected override bool CollidedWithPlayer(BosuPlayer player) => false;