Exemplo n.º 1
0
 /// <summary>
 /// Add a new component to an entry in a template
 /// </summary>
 public static void AddComponentToEntry(GenericHierarchyEntry entry, COMPONENT_TYPE type)
 {
     if (entry != null)
     {
         var newComponent = new SceneComponentType();
         newComponent.type             = type;
         newComponent.requiresSubAsset = DoesComponentRequireSubassets(type);
         entry.components.Add(newComponent);
         SetActiveConfigDirty(true);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Simple check to see if the component type uses a subasset
 /// </summary>
 public static bool DoesComponentRequireSubassets(COMPONENT_TYPE type)
 {
     switch (type)
     {
     case COMPONENT_TYPE.PLAYABLE_DIRECTOR:
     case COMPONENT_TYPE.POST_VOLUME:
     case COMPONENT_TYPE.SCENE_VOLUME:
     {
         return(true);
     }
     }
     return(false);
 }
Exemplo n.º 3
0
        public List <COMPONENT_TYPE> getDataSource()
        {
            SqlConnection conn = MSSQLDBUtils.GetDBConnection();

            conn.Open();
            List <COMPONENT_TYPE> list = new List <COMPONENT_TYPE>();
            COMPONENT_TYPE        obj  = null;
            String sql = " Use [rbi] Select [ComponentTypeID]" +
                         ",[ComponentTypeName]" +
                         ",[ComponentTypeCode]" +
                         ",[Shape]" +
                         ",[ShapeFactor]" +
                         "From [rbi].[dbo].[COMPONENT_TYPE]";

            try
            {
                SqlCommand cmd = new SqlCommand();
                cmd.Connection  = conn;
                cmd.CommandText = sql;
                using (DbDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        if (reader.HasRows)
                        {
                            obj = new COMPONENT_TYPE();
                            obj.ComponentTypeID   = reader.GetInt32(0);
                            obj.ComponentTypeName = reader.GetString(1);
                            obj.ComponentTypeCode = reader.GetString(2);
                            if (!reader.IsDBNull(3))
                            {
                                obj.Shape = reader.GetString(3);
                            }
                            obj.ShapeFactor = (float)reader.GetDouble(4);
                            list.Add(obj);
                        }
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString(), "GET DATA FAIL!");
            }
            finally
            {
                conn.Close();
                conn.Dispose();
            }
            return(list);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Remove a component from an entry in a template
 /// </summary>
 public static void RemoveComponentFromEntry(GenericHierarchyEntry entry, COMPONENT_TYPE type)
 {
     if (entry != null)
     {
         for (var i = 0; i < entry.components.Count; i++)
         {
             if (entry.components[i].type == type)
             {
                 entry.components.RemoveAt(i);
                 SetActiveConfigDirty(true);
             }
         }
     }
 }
 public void InitializeModule()
 {
     g_NPCController = GetComponent <NPCController>();
     Type            = COMPONENT_TYPE.CONTROL;
     g_Components    = new Dictionary <COMPONENT_TYPE, GameObject>();
     if (FootSteps.Length > 0)
     {
         if (RightFoot != null)
         {
             InitializeComponent(RightFoot, COMPONENT_TYPE.RIGHT_FOOT);
         }
         if (LeftFoot != null)
         {
             InitializeComponent(LeftFoot, COMPONENT_TYPE.LEFT_FOOT);
         }
     }
 }
 private void InitializeComponent(GameObject go, COMPONENT_TYPE type)
 {
     if (go != null)
     {
         NPCAgentAudio rf      = go.AddComponent <NPCAgentAudio>();
         AudioSource   aSource = go.AddComponent <AudioSource>();
         rf.Type = type;
         if (type == COMPONENT_TYPE.LEFT_FOOT || type == COMPONENT_TYPE.RIGHT_FOOT)
         {
             FootstepsAudioEnabled = true;
             aSource.clip          = LastFootstepAssigned < FootSteps.Length ? FootSteps[LastFootstepAssigned] : FootSteps[0];
             LastFootstepAssigned++;
         }
         g_Components.Add(type, go);
     }
     else
     {
         g_NPCController.Debug(NPCModuleName() + " - Attempted to initialize an audio component with empty game object");
     }
 }
Exemplo n.º 7
0
 public void delete(COMPONENT_TYPE obj)
 {
     DAL.delete(obj.ComponentTypeID);
 }
Exemplo n.º 8
0
 public void edit(COMPONENT_TYPE obj)
 {
     DAL.edit(obj.ComponentTypeID, obj.ComponentTypeName, obj.ComponentTypeCode, obj.Shape, obj.ShapeFactor);
 }
Exemplo n.º 9
0
 public void add(COMPONENT_TYPE obj)
 {
     DAL.add(obj.ComponentTypeID, obj.ComponentTypeName, obj.ComponentTypeCode);
 }
Exemplo n.º 10
0
        /// <summary>
        /// Manages the adding of components to generated scene objects. Supports generating sub-assets for those components that need them
        /// </summary>
        private static void AddNewComponent(GameObject go, COMPONENT_TYPE type)
        {
            switch (type)
            {
            case COMPONENT_TYPE.CAMERA:
            {
                var cam = go.GetOrAddComponent <Camera>();
                break;
            }

            case COMPONENT_TYPE.AUDIO_LISTENER:
            {
                go.GetOrAddComponent <AudioListener>();
                break;
            }

            case COMPONENT_TYPE.CINEMACHINE_BRAIN:
            {
                go.GetOrAddComponent <CinemachineBrain>();
                break;
            }

            case COMPONENT_TYPE.PLAYABLE_DIRECTOR:
            {
                var pd = go.GetOrAddComponent <PlayableDirector>();
                if (!AssetDatabase.IsValidFolder("Assets/Timeline"))
                {
                    AssetDatabase.CreateFolder("Assets", "Timeline");
                }
                var ta = ScriptableObjectUtility.CreateAssetType <TimelineAsset>("Assets/Timeline", "MasterTimeline.asset");
                pd.playableAsset = ta;
                break;
            }

            case COMPONENT_TYPE.POST_LAYER:
            {
                var post      = go.GetOrAddComponent <PostProcessLayer>();
                var postLayer = 1 << 8;               // post layer is 8 by default
                post.volumeLayer      = postLayer;    // LayerMask.NameToLayer("PostProcessing"); <= this doesn't work for some reason
                post.antialiasingMode = PostProcessLayer.Antialiasing.TemporalAntialiasing;
                break;
            }

            case COMPONENT_TYPE.POST_VOLUME:
            {
                var post = go.GetOrAddComponent <PostProcessVolume>();
                post.isGlobal = true;
                var targetName = go.name;
                var scene      = go.scene;

                // create a new profile
                var asset = ProfileFactory.CreatePostProcessProfile(scene, scene.name);

                // find & load the template
                // FIXME: should allow for user templates as well
                var templatePath = Settings.TEMPLATECONFIGPATH + "Default_Profiles/Default_PostProfile.asset";
                var template     = AssetDatabase.LoadAssetAtPath(templatePath, typeof(PostProcessProfile)) as PostProcessProfile;

                if (template != null)
                {
                    // add all of the settings to the template
                    foreach (var effect in template.settings)
                    {
                        asset.AddSettings(effect);
                    }
                }
                else
                {
                    Debug.Log("Could not find template post profile?");
                }

                post.profile          = asset;
                post.isGlobal         = true;
                post.gameObject.layer = LayerMask.NameToLayer("PostProcessing");
                break;
            }

            case COMPONENT_TYPE.SCENE_VOLUME:
            {
#if USING_HDRP
                var vol = go.GetOrAddComponent <Volume>();
                vol.isGlobal = true;
                var targetName = go.name;
                var scene      = go.scene;

                // FIXME: should load a volume profile from a template &
                // copy the components from one in the package as a base / starting point
                var asset = VolumeProfileFactory.CreateVolumeProfile(scene, targetName);

                vol.profile  = asset;
                vol.isGlobal = true;
#endif
                break;
            }

            case COMPONENT_TYPE.RENDER_SETTINGS:
            {
                var settings = go.GetOrAddComponent <RenderSettings>();
                // add our basic low / high detail levels to start
                var levels = new List <DetailLevel>()
                {
                    new DetailLevel()
                    {
                        name                   = "Low",
                        reflectionProbes       = false,
                        planarReflectionProbes = false,
                    },
                    new DetailLevel()
                    {
                        name                   = "High",
                        reflectionProbes       = true,
                        planarReflectionProbes = true,
                    }
                };

                settings.detailLevels.AddRange(levels);
                break;
            }

            default:
            {
                Debug.Log("unrecognized component type");
                break;
            }
            }
        }