Example #1
0
        public bool NeerGlassEaterAble(PlayerMather player, Direction direct)
        {
            float GEDistance; //ターゲットの草食獣との距離

            switch (direct)
            {
            case Direction.RIGHT:

                GEDistance = player.playerPos.X + (TextureSize / 2) - enemyPos.X + (TextureSize / 2);
                if (GEDistance > 0)
                {
                    return(false);
                }

                break;

            case Direction.LEFT:

                GEDistance = player.playerPos.X + (TextureSize / 2) - enemyPos.X + (TextureSize / 2);
                if (GEDistance < 0)
                {
                    return(false);
                }

                break;

            case Direction.TOP:
                //Y座標の距離
                GEDistance = player.playerPos.Y + (TextureSize / 2) - enemyPos.Y + (TextureSize / 2);
                if (GEDistance < 0)
                {
                    return(false);
                }

                break;

            case Direction.BOTTOM:
                //Y座標の距離
                GEDistance = (player.playerPos.Y + (TextureSize / 2)) - (enemyPos.Y + (TextureSize / 2));
                if (GEDistance > 0)
                {
                    return(false);
                }

                break;

            case Direction.NULL:
                break;

            default:
                break;
            }
            return(true);
        }
Example #2
0
 public static bool WallXPlayer(Wall wall, PlayerMather player)
 {
     if (wall.position.X <= player.movePos.X + player.TextureSize &&//壁の左側
         wall.position.X + wall.rectangle.Width >= player.movePos.X - player.TextureSize &&  //壁の右側
         wall.position.Y + wall.rectangle.Height >= player.movePos.Y - player.TextureSize && //壁の下側
         wall.position.Y <= player.movePos.Y + player.TextureSize)                           //壁の上側
     {
         return(true);                                                                       //当たってる
     }
     return(false);
 }
Example #3
0
        public bool GEDistance(PlayerMather now, PlayerMather judge)
        {
            Vector2 nowPlayerXEnemy   = new Vector2(Math.Abs(now.playerPos.X - enemyPos.X), Math.Abs(now.playerPos.Y - enemyPos.Y));
            Vector2 judgePlayerXEnemy = new Vector2(Math.Abs(judge.playerPos.X - enemyPos.X), Math.Abs(judge.playerPos.Y - enemyPos.Y));

            if (nowPlayerXEnemy.X > judgePlayerXEnemy.X || nowPlayerXEnemy.Y > judgePlayerXEnemy.Y)
            {
                return(true);
            }

            return(false);
        }
Example #4
0
 public static Direction WallXPlayerDirection(Wall wall, PlayerMather player)
 {
     if (wall.position.X + wall.rectangle.Width <= player.playerPos.X)
     {//壁の右側(進行方向は左)
         return(Direction.LEFT);
     }
     else if (wall.position.X >= player.playerPos.X + player.TextureSize)
     {//壁の左側(進行方向は右)
         return(Direction.RIGHT);
     }
     else if (wall.position.Y >= player.playerPos.Y + player.TextureSize)
     {//壁の上側(進行方向は下)
         return(Direction.BOTTOM);
     }
     else if (wall.position.Y + wall.rectangle.Height >= player.playerPos.Y)
     {//壁の側(進行方向は)
         return(Direction.TOP);
     }
     return(Direction.NULL);
 }