Exemplo n.º 1
0
    private void OnEnable()
    {
        IEnumerable <Type> moduleTypes = Assembly.GetAssembly(typeof(EffectModule))
                                         .GetTypes().Where(t => t.IsClass && !t.IsAbstract && t.IsSubclassOf(typeof(EffectModule)));

        modulesMenu = new GenericMenu();
        foreach (Type item in moduleTypes)
        {
            CustomEffectModuleAttribute attribute =
                (CustomEffectModuleAttribute)Attribute.GetCustomAttribute(item, typeof(CustomEffectModuleAttribute));
            if (attribute == null || string.IsNullOrEmpty(attribute.MenuName))
            {
                continue;
            }

            /* For optional attribute
             * string name = attribute != null && !string.IsNullOrEmpty(attribute.MenuName) ?
             *  attribute.MenuName : ObjectNames.NicifyVariableName(item.Name);
             */

            //Debug.Log("Added to menu: " + item);
            modulesMenu.AddItem(new GUIContent(attribute.MenuName),
                                false,
                                () => AddModule(item));
        }

        effect = (NeepEffect)target;
        //effect.OnAddModulePress += OpenModulesMenu;
    }
Exemplo n.º 2
0
        protected override void OnInitialize(NeepEffect owner)
        {
            if (profile == null)
            {
                profile = CreateInstance <PostProcessProfile>();
            }

            volume               = owner.ContainerGameObject.AddComponent <PostProcessVolume>();
            volume.isGlobal      = true;
            volume.sharedProfile = profile;

            // Warm up the unloaded shaders to avoid "hiccups" with the fps when the effect starts
            // (Not really working)
            Shader.WarmupAllShaders();
            // TODO: create an instance of ShaderVariantCollection add the shaders and call WarmUp()
        }
Exemplo n.º 3
0
 protected override void OnInitialize(NeepEffect owner)
 {
     filter = Owner.Manager.AudioListener.gameObject.AddComponent <AudioFilterT>();
 }
Exemplo n.º 4
0
 protected override void OnInitialize(NeepEffect owner)
 {
     ui = owner.Manager.UI;
 }
Exemplo n.º 5
0
 protected virtual void OnInitialize(NeepEffect owner)
 {
 }
Exemplo n.º 6
0
 internal void Initialize(NeepEffect owner)
 {
     this.owner = owner;
     OnInitialize(owner);
 }