コード例 #1
0
 private bool SkeleAttack(MonogameSkeleton skele)
 {
     if (skele.Intersects(player))
     {
         if (skele.PerPixelCollision(player))
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #2
0
 private bool PlayerAttack(MonogameSkeleton skele)
 {
     foreach (AttackRectangle attackRect in player.attackRects)
     {
         if (skele.Intersects(attackRect))
         {
             if (skele.CurrentState.ToString() == player.AttackDir.ToString())
             {
                 return(true);
             }
         }
     }
     return(false);
 }
コード例 #3
0
        private void AddSkeletonToList(string direction)
        {
            MonogameSkeleton skeleton = new MonogameSkeleton(this.Game);

            skeleton.Initialize();
            skeleton.NewSpeed = (speedBpmCalulation * songManager.Bps) / difficulty;

            if (direction == "Top")
            {
                skeleton.CurrentState = SkeletonEnum.Up;
                skeleton.Direction    = new Vector2(0, 1);
                skeleton.Location     = new Vector2(GraphicsDevice.Viewport.Width / 2 - skeleton.spriteTexture.Width / 2, 0 - skeleton.spriteTexture.Height);
            }
            else if (direction == "Bottom")
            {
                skeleton.CurrentState = SkeletonEnum.Down;
                skeleton.Direction    = new Vector2(0, -1);
                skeleton.Location     = new Vector2(GraphicsDevice.Viewport.Width / 2 - skeleton.spriteTexture.Width / 2, GraphicsDevice.Viewport.Height + skeleton.spriteTexture.Height);
            }
            else if (direction == "Left")
            {
                skeleton.CurrentState = SkeletonEnum.Left;
                skeleton.Direction    = new Vector2(1, 0);
                skeleton.Location     = new Vector2(0 - skeleton.spriteTexture.Width, GraphicsDevice.Viewport.Height / 2 - skeleton.spriteTexture.Height / 2);
            }
            else if (direction == "Right")
            {
                skeleton.CurrentState = SkeletonEnum.Right;
                skeleton.Direction    = new Vector2(-1, 0);
                skeleton.Location     = new Vector2(GraphicsDevice.Viewport.Width + skeleton.spriteTexture.Width, GraphicsDevice.Viewport.Height / 2 - skeleton.spriteTexture.Height / 2);
            }
            skeleton.SetTranformAndRect();
            skeleton.Enabled = true;
            skeleton.Visible = true;
            skeletons.Add(skeleton);
        }