示例#1
0
    public float EdgeCost(Coord c, int edge)
    {
        float        cost = edgeDirs[edge].GetMagnitude();
        EdgeMoveType m    = GetEdgeMoveType(edge);

        switch (m)
        {
        case EdgeMoveType.Fall: cost += extraFallCost; break;

        case EdgeMoveType.Jump: cost += extraJumpCost; break;
        }
        return(cost);
    }
示例#2
0
        void RefreshDebugFromArrow()
        {
            if (debugVisibleObject == null)
            {
                return;
            }
            Vector3 u = Vector3.up * .125f, start = u + astar.maze.GetGroundPosition(_from), end = u + astar.maze.GetGroundPosition(coord);

            if (fromArrow == null)
            {
                fromArrow = Lines.MakeWire(); fromArrow.gameObject.transform.SetParent(debugVisibleObject.transform);
            }
            EdgeMoveType mtype = GetEdgeMoveType(_edge);

            switch (mtype)
            {
            case EdgeMoveType.None:
                fromArrow.Arrow(start, end, Color.yellow);
                break;

            case EdgeMoveType.Walk:
                fromArrow.Arrow(start, end, Color.cyan);
                break;

            case EdgeMoveType.Fall:
                Vector3 startCp = end;
                startCp.y = start.y + 1;
                fromArrow.Bezier(start, startCp, end + Vector3.up, end, Color.blue);
                break;

            case EdgeMoveType.Jump:
                Vector3 mid = (start + end) / 2 + Vector3.up * 3;
                fromArrow.Bezier(start, (start + mid) / 2, (end + mid) / 2, end, Color.green);
                break;

            case EdgeMoveType.OOB:
                fromArrow.Arrow(start, end, Color.magenta);
                break;
            }
        }