Ejemplo n.º 1
0
        public void RangefParseVerification()
        {
            string rangeString  = "-12098.43 234987.4293";
            string rangeString2 = "0";

            Rangef range1 = Rangef.Parse(rangeString);
            Rangef range2 = Rangef.Parse(rangeString2);

            Assert.IsWithin(-12098.43f, range1.Low, 0.01f);
            Assert.IsWithin(234987.4293f, range1.High, 0.1f);

            Assert.AreEqual(range2.Low, range2.High);
        }
Ejemplo n.º 2
0
            public StationInfo(XmlNode stationNode, GameObject assetsPrototypeRoot)
            {
                // Type (Mandatory)
                XmlNode typeNode = stationNode.SelectSingleNode("@type");

                if (typeNode != null)
                {
                    mType = typeNode.InnerText;
                    if (mType != "Hair" &&
                        mType != "Makeup" &&
                        mType != "Sewing" &&
                        mType != "Holding")
                    {
                        throw new Exception("Unknown Fashion Game Station Type (" + mType + ")");
                    }
                }
                else
                {
                    throw new Exception("No type attribute found on Station node. Cannot create station info.");
                }

                // Asset (Mandatory)
                XmlNode assetNode = stationNode.SelectSingleNode("@asset");

                if (assetNode != null)
                {
                    mAssetPrototype = GameObjectUtility.GetNamedChild(assetNode.InnerText, assetsPrototypeRoot);
                }
                else
                {
                    throw new Exception("No asset attribute found on Station node. Cannot create station info.");
                }

                // Time (Optional)
                XmlNode timeNode = stationNode.SelectSingleNode("@time");

                if (timeNode != null)
                {
                    mTime = Rangef.Parse(timeNode.InnerText).RandomValue();
                }
                else
                {
                    mTime = 0.0f;
                }

                // Icon (Mandatory)
                XmlNode imagePathNode = stationNode.SelectSingleNode("Icon/@path");

                if (imagePathNode != null)
                {
                    mImagePath = ProtocolUtility.ResolvePath(imagePathNode.InnerText);
                }
                else
                {
                    mImagePath = null;
                }

                // Gui Offset (Optional)
                XmlNode guiOffsetNode = stationNode.SelectSingleNode("@guiOffset");

                if (guiOffsetNode != null)
                {
                    mGuiOffset = SerializationUtility.ToVector3(guiOffsetNode.InnerText);
                }
                else
                {
                    mGuiOffset = Vector3.zero;
                }

                // Sounds (Optional, Multiple Supported)
                XmlNodeList soundNodes = stationNode.SelectNodes("ActivationSound/@path");

                foreach (XmlNode soundNode in soundNodes)
                {
                    mSoundPaths.Add(soundNode.InnerText);
                }

                // WorkingAnimation (Optional)
                XmlNode workingAnimationNode = stationNode.SelectSingleNode("WorkingAnimation/@path");

                if (workingAnimationNode != null)
                {
                    mWorkingAnimationPath = workingAnimationNode.InnerText;
                }
                else
                {
                    mWorkingAnimationPath = null;
                }

                // IdleAnimation (Optional)
                XmlNode idleAnimationNode = stationNode.SelectSingleNode("IdleAnimation/@path");

                if (idleAnimationNode != null)
                {
                    mIdleAnimationPath = idleAnimationNode.InnerText;
                }
                else
                {
                    mIdleAnimationPath = null;
                }
            }