Exemplo n.º 1
0
    public override string ToChatString(GameWorldController gameWorldController)
    {
        MobData mobData  = gameWorldController.Model.GetMobData(MobID);
        MobType mobType  = MobTypeManager.GetMobTypeByName(mobData.mob_type_name);
        float   distance = Point3d.Distance(FromPosition, ToPosition);

        MathConstants.eDirection direction = MathConstants.GetDirectionForAngle(ToAngle);
        string facing = "";

        switch (direction)
        {
        case MathConstants.eDirection.none:
            facing = "South";
            break;

        case MathConstants.eDirection.right:
            facing = "East";
            break;

        case MathConstants.eDirection.up:
            facing = "North";
            break;

        case MathConstants.eDirection.left:
            facing = "West";
            break;

        case MathConstants.eDirection.down:
            facing = "South";
            break;
        }

        return(base.ToChatString(gameWorldController) + mobType.Name + " moved " + distance.ToString("F1") + " feet, now facing " + facing);
    }
Exemplo n.º 2
0
        private float ComputeTraversalCost(uint navCellIndex, uint neighborNavCellIndex)
        {
            Point3d center         = m_navMesh.ComputeNavCellCenter(navCellIndex);
            Point3d neighborCenter = m_navMesh.ComputeNavCellCenter(neighborNavCellIndex);

            return(Point3d.Distance(center, neighborCenter));
        }
Exemplo n.º 3
0
    public override string ToChatString(GameWorldController gameWorldController)
    {
        string characterName = gameWorldController.Model.GetCharacterData(CharacterID).character_name;
        float  distance      = (Point3d.Distance(FromPosition, ToPosition));

        MathConstants.eDirection direction = MathConstants.GetDirectionForAngle(ToAngle);
        string facing = "";

        switch (direction)
        {
        case MathConstants.eDirection.none:
            facing = "South";
            break;

        case MathConstants.eDirection.right:
            facing = "East";
            break;

        case MathConstants.eDirection.up:
            facing = "North";
            break;

        case MathConstants.eDirection.left:
            facing = "West";
            break;

        case MathConstants.eDirection.down:
            facing = "South";
            break;
        }

        return(base.ToChatString(gameWorldController) + characterName + " moved " + distance.ToString("F1") + " feet, now facing " + facing);
    }
Exemplo n.º 4
0
        /// <summary>
        /// 两点绘制圆
        /// </summary>
        /// <param name="db">图形数据库</param>
        /// <param name="point1">第一个电</param>
        /// <param name="point2">第二个点</param>
        /// <returns></returns>
        public static ObjectId AddCircleModeSpace(this Database db, Point3d point1, Point3d point2)
        {
            // 获取两点的中心点
            Point3d center = point1.MidPoint(point2);
            // 获取半径
            double radius = point1.Distance(center);

            return(db.AddCircleModeSpace(center, radius));
        }
Exemplo n.º 5
0
        /// <summary>
        /// 三点绘制椭圆
        /// </summary>
        /// <param name="db">图形数据库</param>
        /// <param name="majorPoint1">长轴端点1</param>
        /// <param name="majorPoint2">长轴端点2</param>
        /// <param name="shortRadius">短轴的长度</param>
        /// <returns>ObjectId</returns>
        public static ObjectId AddEllipseToModeSpace(this Database db, Point3d majorPoint1, Point3d majorPoint2, double shortRadius)
        {
            // 椭圆圆心
            Point3d center = majorPoint1.MidPoint(majorPoint2);
            // 短轴与长轴的比例
            double ratio = 2 * shortRadius / majorPoint1.Distance(majorPoint2);
            // 长轴的向量
            Vector3d majorAxis = majorPoint2.GetVectorTo(center);
            Ellipse  elli      = new Ellipse(center, Vector3d.ZAxis, majorAxis, ratio, 0, 2 * Math.PI);

            return(db.AddEntityToModeSpace(elli));
        }
Exemplo n.º 6
0
 private float ComputeHeuristicCostEstimate(Point3d start, Point3d end)
 {
     return(Point3d.Distance(start, end));
 }