private bool collidedWithPlayer(TouhouPlayer player) { // Let's assume that player is a circle for simplicity var playerPosition = player.PlayerPosition(); 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); }
public TouhouPlayfield(TouhouHealthProcessor healthProcessor) { this.healthProcessor = healthProcessor; InternalChildren = new Drawable[] { new TouhouBackground(), new Container { RelativeSizeAxes = Axes.Both, Masking = true, Children = new Drawable[] { HitObjectContainer, Player = new TouhouPlayer() } } }; }
public void GetPlayerToTrace(TouhouPlayer player) => Player = player;