private void AddTileAnimatorsTo(GameObject gameObject, XElement goXml) { // This object will only visible for a given moment of time within an animation var animXml = goXml.Element("TileAnimator"); if (animXml != null) { TileAnimator tileAnimator = gameObject.AddComponent <TileAnimator>(); tileAnimator.StartTime = ImportUtils.GetAttributeAsInt(animXml, "startTimeMs") * 0.001f; tileAnimator.Duration = ImportUtils.GetAttributeAsInt(animXml, "durationMs") * 0.001f; tileAnimator.TotalAnimationTime = ImportUtils.GetAttributeAsInt(animXml, "fullTimeMs") * 0.001f; } }
private void AddTileAnimatorsTo(GameObject gameObject, XElement goXml) { foreach (var animXml in goXml.Elements("TileAnimator")) { TileAnimator tileAnimator = gameObject.AddComponent <TileAnimator>(); foreach (var frameXml in animXml.Elements("Frame")) { TileAnimator.Frame frame = new TileAnimator.Frame(); frame.Vertex_z = ImportUtils.GetAttributeAsFloat(frameXml, "vertex_z"); frame.DurationMs = ImportUtils.GetAttributeAsInt(frameXml, "duration"); tileAnimator.frames.Add(frame); } } }