コード例 #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);
        }
コード例 #2
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);

            // 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);
        }
コード例 #3
0
 /// <summary>
 /// Adds an entity to the Scene, and consumes the specified ID Slot.
 /// </summary>
 /// <param name="entity">Entity to add to the scene.</param>
 private void AddEntity(EditorEntity entity)
 {
     entity.Entity.Object.Entities.Add(entity.Entity);
     this.entities.Add(entity);
     entitiesBySlot[entity.Entity.SlotID] = entity;
 }