예제 #1
0
        /// <summary>
        /// Creates an instance description based from the blueprint name and the public properties of the entity
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static string InstanceToPCNString(Entity entity)
        {
            string name = entity.Properties.GetString(PROPERTY_NAME_BLUEPRINT, null);

            if (name != null)
            {
                string result = "";
                result += name;

                string members = PhantomComponentNotation.PropertiesToPCNString(entity.Properties);
                if (members != "")
                {
                    members = "," + members;
                }
                if (entity.Orientation != 0)
                {
                    members = "," + PROPERTY_NAME_ORIENTATION + "=" + PhantomComponentNotation.ValueToString(MathHelper.ToDegrees(entity.Orientation), "0.0") + members;
                }
                members = PROPERTY_NAME_POSITION + "=" + PhantomComponentNotation.ValueToString(entity.Position, "0") + members;
                result += "(" + members + ")";
                return(result);
            }
            return(null);
        }
예제 #2
0
        private static string GetMapData()
        {
            string    data = "";
            GameState map  = GetState();

            foreach (Component component in map.Components)
            {
                if (component.Properties != null && component.Properties.GetString("editable", null) != null)
                {
                    data += "component " + component.Properties.GetString("editable", "") + "(" + PhantomComponentNotation.PropertiesToPCNString(component.Properties) + ")\n";

                    if (component is EntityLayer)
                    {
                        data += GetEntityData((EntityLayer)component) + "\n";
                    }
                }
            }
            return(data);
        }