Exemplo n.º 1
0
        public static void ProcessMapObjectCommand(DebugCommand message, MapObjectContext context,
                                                   IMapObjectEntityFactory mapObjectEntityFactory, PlayerEntity player)
        {
            switch (message.Command)
            {
            case DebugCommands.ClearSceneObject:
                context.DestroyAllEntities();
                break;

            case DebugCommands.ListDoorEntity:
                var mapEntities = context.GetEntities();
                for (int i = 0; i < mapEntities.Length; ++i)
                {
                    var mapEntity = mapEntities[i];
                    if (mapEntity.hasDoorData && mapEntity.hasRawGameObject)
                    {
                        var obj = mapEntity.rawGameObject.Value;

                        string path = "/" + obj.name;
                        while (obj.transform.parent != null)
                        {
                            obj  = obj.transform.parent.gameObject;
                            path = "/" + obj.name + path;
                        }

                        Logger.InfoFormat("DoorEntity {0} {1}", mapEntity, path);
                    }
                }
                break;
            }
        }
Exemplo n.º 2
0
        public static string ListTriggerObj(MapObjectContext context, string[] args)
        {
            var position = new Vector3(
                float.Parse(args[0]),
                float.Parse(args[1]),
                float.Parse(args[2])
                );

            StringBuilder sb = new StringBuilder();

            sb.Append("TriggerObjList:\n");

            var   site   = position;
            float radius = 25f;

            foreach (var MapObj in context.GetEntities())
            {
                if (MapObj == null)
                {
                    continue;
                }
                if ((MapObj.position.Value - site).magnitude <= radius)
                {
                    if (!MapObj.hasRawGameObject || MapObj.rawGameObject.Value == null)
                    {
                        continue;
                    }
                    //sb.AppendFormat("EntityWithoutRaw:{0}, Pos:[{1}]\n", MapObj.GetType(), MapObj.position.Value);
                    sb.AppendFormat("Entity:{0}, Pos:[{1}]\n", MapObj.rawGameObject.Value.name, MapObj.position.Value);
                }
            }

            var result = sb.ToString();

            _logger.ErrorFormat("Time={0}, {1}", MyGameTime.time, result);
            return(result);
        }