Esempio n. 1
0
        private EditorEntity GenerateEditorEntity(RSDKv5.SceneEntity sceneEntity)
        {
            try
            {
                // ideally this would be driven by configuration...one day
                // or can we assume anything with a "Go" and "Tag" Attributes is linked to another?
                if (sceneEntity.Object.Name.ToString().Equals("WarpDoor", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(new LinkedEditorEntity(sceneEntity));
                }
            }
            catch
            {
                Debug.WriteLine("Failed to generate a LinkedEditorEntity, will create a basic one instead.");
            }

            EditorEntity entity = new EditorEntity(sceneEntity);

            if (entity.hasFilter && DefaultFilter > -1)
            {
                entity.Entity.GetAttribute("filter").ValueUInt8 = (byte)DefaultFilter;
                DefaultFilter = -1;
            }

            entity.SetFilter();

            return(entity);
        }
        private EditorEntity GenerateEditorEntity(RSDKv5.SceneEntity sceneEntity)
        {
            try
            {
                // ideally this would be driven by configuration...one day
                // or can we assume anything with a "Go" and "Tag" Attributes is linked to another?
                if (sceneEntity.Object.Name.ToString().Equals("WarpDoor", StringComparison.InvariantCultureIgnoreCase))
                {
                    return(new LinkedEditorEntity(sceneEntity));
                }
            }
            catch
            {
                Debug.WriteLine("Failed to generate a LinkedEditorEntity, will create a basic one instead.");
            }

            EditorEntity entity = new EditorEntity(sceneEntity);

            // Check the first entity spawned to see if this Scene uses filters
            if (FirstEntity)
            {
                FirstEntity = false;

                // Try to get "filter"
                try
                {
                    int filter = entity.Entity.GetAttribute("filter").ValueUInt8;
                }

                // If this is an old Scene that doesn't have them, disable future filter checks
                catch (KeyNotFoundException)
                {
                    SceneWithoutFilters = true;
                }
            }

            if (!SceneWithoutFilters && DefaultFilter > -1)
            {
                entity.Entity.GetAttribute("filter").ValueUInt8 = (byte)DefaultFilter;
                DefaultFilter = -1;
            }

            entity.SetFilter();

            return(entity);
        }