示例#1
0
        private static string GetNodeString(int x, short y, IDimensionalModelData model, bool forWeb)
        {
            IDimensionalModelNode node = model.GetNode((short)(x + 1), (short)(y + 1));

            string nodeString = string.Empty;

            if (node != null)
            {
                nodeString = DamageTypeToCharacter(node.Style, x < 5);

                if (forWeb)
                {
                    nodeString = string.Format("<a title='{0}'>{1}</a>"
                                               , node.Composition == null ? string.Empty : node.Composition.Name
                                               , nodeString);
                }
            }
            else if (forWeb)
            {
                nodeString = "<a title=''> </a>";
            }

            return(nodeString);
        }
示例#2
0
        /// <summary>
        /// Gets the node behind the indicated node
        /// </summary>
        /// <param name="xAxis">the X-Axis of the initial node to get</param>
        /// <param name="yAxis">the Y-Axis of the initial node to get</param>
        /// <param name="zAxis">the Z-Axis of the initial node to get</param>
        /// <param name="pitch">rotation on the z-axis</param>
        /// <param name="yaw">rotation on the Y-axis</param>
        /// <param name="roll">rotation on the x-axis</param>
        /// <returns>the node "behind" the node asked for (can be null)</returns>
        public IDimensionalModelNode GetNodeBehindNode(short xAxis, short yAxis, short zAxis, short pitch, short yaw, short roll)
        {
            //Just cut off erroneous requests
            if (ModelType != DimensionalModelType.ThreeD)
            {
                return(null);
            }

            var plane = ModelPlanes.FirstOrDefault(pl => pl.YAxis.Equals(yAxis));
            IDimensionalModelNode node = null;

            //Get the initial node first
            if (plane != null)
            {
                node = plane.GetNode(xAxis, zAxis);
            }

            if (node != null)
            {
                //We need to determine what the actuals are here, we might have axis flipped depending on the perspective angle
                //yaw 1-10 - length = model xAxis 11-1, height = yAxis 11-1, depth = zAxis 1-11
                //yaw 11-21 - length = model zAxis 1-11, height = yAxis 11-1, depth = xAxis 1-11
                //yaw 22-32 - length = model xAxis 1-11, height = yAxis 11-1, depth = zAxis 11-1
                //yaw 33-43 - length = model zAxis 11-1, height = yAxis 11-1, depth = xAxis 11-1

                //roll 1-10 - length = model xAxis 11-1, height = yAxis 11-1, depth = zAxis 1-11
                //roll 11-21 - length = model yAxis 1-11, height = xAxis 1-1, depth = zAxis 1-11
                //roll 22-32 - length = model xAxis 1-11, height = yAxis 1-1, depth = zAxis 1-11
                //roll 33-43 - length = model yAxis 11-1, height = xAxis 11-1, depth = zAxis 1-11

                //pitch 1-10 - length = model xAxis 11-1, height = yAxis 11-1, depth = zAxis 1-11
                //pitch 11-21 - length = model xAxis 11-1, height = zAxis 1-11, depth = yAxis 1-11
                //pitch 22-32 - length = model xAxis 11-1, height = yAxis 1-11, depth = zAxis 11-1
                //pitch 33-43 - length = model xAxis 11-1, height = zAxis 11-1, depth = yAxis 11-1

                short zChange = 0, yChange = 0, xChange = 0;

                if (yaw > 0)
                {
                    if (yaw <= 10)
                    {
                        zChange++;
                        xChange++;
                    }
                    else if (yaw == 11)
                    {
                        xChange--;
                    }
                    else if (yaw <= 21)
                    {
                        xChange--;
                        zChange--;
                    }
                    else if (yaw == 22)
                    {
                        zChange++;
                    }
                    else if (yaw <= 32)
                    {
                        zChange++;
                        xChange--;
                    }
                    else if (yaw == 33)
                    {
                        xChange--;
                    }
                    else
                    {
                        xChange--;
                        zChange++;
                    }
                }

                if (roll > 0)
                {
                    zChange++;
                }

                if (pitch > 0)
                {
                    if (pitch <= 10)
                    {
                        zChange++;
                        yChange++;
                    }
                    else if (pitch == 11)
                    {
                        yChange++;
                    }
                    else if (pitch <= 21)
                    {
                        yChange++;
                        zChange--;
                    }
                    else if (pitch == 22)
                    {
                        zChange--;
                    }
                    else if (pitch <= 32)
                    {
                        zChange--;
                        yChange--;
                    }
                    else if (pitch == 33)
                    {
                        yChange--;
                    }
                    else
                    {
                        yChange--;
                        zChange++;
                    }
                }

                if (roll == 0 && yaw == 0 && pitch == 0)
                {
                    zChange++;
                }

                if (xChange > 1)
                {
                    xChange = 1;
                }
                if (xChange < -1)
                {
                    xChange = -1;
                }

                if (yChange > 1)
                {
                    yChange = 1;
                }
                if (yChange < -1)
                {
                    yChange = -1;
                }

                if (zChange > 1)
                {
                    zChange = 1;
                }
                if (zChange < -1)
                {
                    zChange = -1;
                }

                short newX = (short)(xAxis + xChange);
                short newY = (short)(yAxis + yChange);
                short newZ = (short)(zAxis + zChange);

                return(GetNode(newX, newY, newZ));
            }

            return(null);
        }