예제 #1
0
 void Start()
 {
     menuGraphics = GameObject.Find("Main Camera").GetComponent <PostProcessVolume>();
     menuGraphics.profile.TryGetSettings(out dof);
     panels[0].SetActive(true);
 }
예제 #2
0
 /// <summary>
 /// On init we initialize our values
 /// </summary>
 protected override void Initialization()
 {
     base.Initialization();
     _volume = this.gameObject.GetComponent <PostProcessVolume>();
     _volume.profile.TryGetSettings(out _colorGrading);
 }
 protected virtual void Awake()
 {
     _volume = this.gameObject.GetComponent <PostProcessVolume>();
     _volume.profile.TryGetSettings(out _chromaticAberration);
     Shaking = false;
 }
예제 #4
0
 private void Start()
 {
     postProcessVolume = gameObject.AddComponent <PostProcessVolume>();
 }
예제 #5
0
 public void Start()
 {
     volume = GetComponent <PostProcessVolume>();
 }
예제 #6
0
    public void gotoHell()
    {
        PostProcessVolume effects = view.GetComponent <PostProcessVolume>();

        effects.profile = hellprofile;
    }
예제 #7
0
 public void SetPostProcess(Scene scene, LoadSceneMode mode)
 {
     ppProfile = FindObjectOfType <PostProcessVolume>();
     ppLayer   = FindObjectOfType <PostProcessLayer>();
 }
예제 #8
0
 private void Awake()
 {
     postProcessVolume = GetComponent<PostProcessVolume>();
     postProcessVolume.profile.TryGetSettings(out bloom);
 }
 // Start is called before the first frame update
 void Start()
 {
     camImgFx = FindObjectOfType <PostProcessVolume>();
 }
예제 #10
0
 void Start()
 {
     vol    = GetComponent <PostProcessVolume>();
     player = GameObject.FindGameObjectWithTag("Player");
     box    = GetComponent <BoxCollider>();
 }
 void Start()
 {
     m_volume = GetComponent <PostProcessVolume>();
 }
예제 #12
0
        public static void SetupPostProcessing()
        {
#if UNITY_POST_PROCESSING_STACK_V2 && UNITY_2018_3_OR_NEWER
            const string defaultName = "WeatherMakerPostProcessingProfile_Default";
            string[]     assets      = AssetDatabase.FindAssets("WeatherMakerPrefab");
            foreach (string asset in assets)
            {
                string path = AssetDatabase.GUIDToAssetPath(asset);
                if (path.EndsWith("WeatherMakerPrefab.prefab", StringComparison.OrdinalIgnoreCase))
                {
                    string dir         = Path.GetDirectoryName(path);
                    string profilesDir = Path.Combine(dir, "Profiles");
                    profilesDir = Path.Combine(profilesDir, "PostProcessing");
                    string assetPath = Path.Combine(profilesDir, defaultName + ".asset");
                    Directory.CreateDirectory(profilesDir);
                    PostProcessProfile profile = AssetDatabase.LoadAssetAtPath <PostProcessProfile>(assetPath);

                    if (profile == null)
                    {
                        EditorUtility.DisplayDialog("Error", "Unable to find Weather Maker default post processing profile at '" + assetPath + "'", "OK");
                        return;

                        /*
                         * profile = ScriptableObject.CreateInstance<PostProcessProfile>();
                         * profile.name = defaultName;
                         * AmbientOcclusion ambient = profile.AddSettings<AmbientOcclusion>();
                         * ambient.intensity = new FloatParameter { value = 0.5f, overrideState = true };
                         * Bloom bloom = profile.AddSettings<Bloom>();
                         * bloom.intensity = new FloatParameter { value = 3.0f, overrideState = true };
                         * ColorGrading color = profile.AddSettings<ColorGrading>();
                         * color.tonemapper = new TonemapperParameter { value = Tonemapper.ACES, overrideState = true };
                         * color.postExposure = new FloatParameter { value = 0.7f, overrideState = true };
                         * DepthOfField df = profile.AddSettings<DepthOfField>();
                         * df.focusDistance = new FloatParameter { value = 3.5f, overrideState = true };
                         * Vignette vig = profile.AddSettings<Vignette>();
                         * vig.intensity = new FloatParameter { value = 0.3f, overrideState = true };
                         *
                         * if (createProfile)
                         * {
                         *  AssetDatabase.CreateAsset(profile, assetPath);
                         *  AssetDatabase.SaveAssets();
                         *  AssetDatabase.Refresh();
                         *  EditorUtility.FocusProjectWindow();
                         * }
                         */
                    }

                    Camera cam = Camera.main;
                    if (cam == null)
                    {
                        EditorUtility.DisplayDialog("Error", "Could not find main camera in scene, make sure your camera is tagged as main camera", "OK");
                        return;
                    }

                    PostProcessLayer layer = cam.GetComponent <PostProcessLayer>();
                    if (layer == null)
                    {
                        layer = Undo.AddComponent <PostProcessLayer>(cam.gameObject);
                    }
                    layer.antialiasingMode = PostProcessLayer.Antialiasing.SubpixelMorphologicalAntialiasing;
                    layer.fog = new Fog {
                        enabled = false, excludeSkybox = true
                    };
                    layer.volumeLayer = -1;

                    PostProcessVolume volume = cam.GetComponent <PostProcessVolume>();
                    if (volume == null)
                    {
                        volume = Undo.AddComponent <PostProcessVolume>(cam.gameObject);
                    }
                    volume.sharedProfile = profile;
                    volume.isGlobal      = true;
                    Undo.RegisterCompleteObjectUndo(layer, "Weather Maker Add Post Processing Volume");

                    Selection.activeObject = cam.gameObject;

                    EditorUtility.DisplayDialog("Success", "Post processing profile created at '" + defaultName + "' and applied to main camera. " +
                                                "You should configure your layer on the camera and post processing for best performance.", "OK");

                    return;
                }
            }

            EditorUtility.DisplayDialog("Error", "There was an error setting up the post processing stack, please do it manually", "OK");
#else
            EditorUtility.DisplayDialog("Error", "Please use Unity 2018.3 or newer and use the package manager to add the post processing stack v2. " +
                                        "Also be sure 'UNITY_POST_PROCESSING_STACK_V2' is in player settings -> scripting defines. Do all this and try again.", "OK");
#endif
        }
예제 #13
0
 void Start()
 {
     processingVol = this.GetComponent <PostProcessVolume>();
     processingVol.profile.TryGetSettings(out colorGradingLayer);
 }
        private void ggop()
        {
            if (Profile.Value != null)
            {
                convert = (PostProcessProfile)Profile.Value;
            }
            else if (Volume.Value != null)
            {
                convert2 = (PostProcessVolume)Volume.Value;
                convert  = convert2.profile;
            }
            if (convert == null)
            {
                return;
            }
            else
            {
                convert.TryGetSettings(out Bloom bloom);

                if (!ActiveRoot.IsNone)
                {
                    bloom.active = ActiveRoot.Value;
                }
                if (!ActiveIntensity.IsNone)
                {
                    bloom.intensity.overrideState = ActiveIntensity.Value;
                }
                if (!ActiveThreshold.IsNone)
                {
                    bloom.threshold.overrideState = ActiveThreshold.Value;
                }
                if (!ActiveSoftKnee.IsNone)
                {
                    bloom.softKnee.overrideState = ActiveSoftKnee.Value;
                }
                if (!ActiveClamp.IsNone)
                {
                    bloom.clamp.overrideState = ActiveClamp.Value;
                }
                if (!ActiveDiffusion.IsNone)
                {
                    bloom.diffusion.overrideState = ActiveDiffusion.Value;
                }
                if (!ActiveAnamorphicRatio.IsNone)
                {
                    bloom.anamorphicRatio.overrideState = ActiveAnamorphicRatio.Value;
                }
                if (!ActiveColor.IsNone)
                {
                    bloom.color.overrideState = ActiveColor.Value;
                }
                if (!ActiveFastMode.IsNone)
                {
                    bloom.fastMode.overrideState = ActiveFastMode.Value;
                }
                if (!ActiveDirtTexture.IsNone)
                {
                    bloom.dirtTexture.overrideState = ActiveDirtTexture.Value;
                }
                if (!ActiveDirtIntensity.IsNone)
                {
                    bloom.dirtIntensity.overrideState = ActiveDirtIntensity.Value;
                }
            }
        }
예제 #15
0
 void Start()
 {
     m_PostProcessVolume = GetComponent <PostProcessVolume>();
     equipmentManager    = gameManager.GetComponent <EquipmentManager>();
     playerStats         = GetComponent <PlayerStats>();
 }
예제 #16
0
 // Start is called before the first frame update
 void Start()
 {
     volume = gameObject.GetComponent <PostProcessVolume>();
     volume.profile.TryGetSettings(out vigneta);
     vigneta.active = false;
 }
예제 #17
0
    public void gotoEarth()
    {
        PostProcessVolume effects = view.GetComponent <PostProcessVolume>();

        effects.profile = earthprofile;
    }
예제 #18
0
    void Update()
    {
        if (gameSpeed >= 0)
        {
            Time.timeScale = gameSpeed;
        }
        if (gameSpeed < 0)
        {
            gameSpeed = 0;
        }

        if (SceneManager.GetActiveScene().name == "Game" && FindObjectOfType <Player>() != null && gameSpeed > 0.0001f)
        {
            gameSessionTime += Time.unscaledDeltaTime;
        }
        //Set speed to normal
        if (PauseMenu.GameIsPaused == false &&
            (FindObjectOfType <Player>() != null) && speedChanged != true)
        {
            gameSpeed = defaultGameSpeed;
        }
        if (SceneManager.GetActiveScene().name != "Game")
        {
            gameSpeed = 1;
        }
        if (FindObjectOfType <Player>() == null)
        {
            gameSpeed = defaultGameSpeed;
        }

        //Restart with R or Space/Resume with Space
        if (SceneManager.GetActiveScene().name == "Game")
        {
            if (PauseMenu.GameIsPaused == true)
            {
                if (restartTimer == -4)
                {
                    restartTimer = 0.5f;
                }
            }
            if (restartTimer > 0)
            {
                restartTimer -= Time.unscaledDeltaTime;
            }
        }

        if (PauseMenu.GameIsPaused == true)
        {
            foreach (AudioSource sound in FindObjectsOfType <AudioSource>())
            {
                if (sound != null)
                {
                    GameObject snd = sound.gameObject;
                    //if(sound!=musicPlayer){
                    if (snd.GetComponent <MusicPlayer>() == null)
                    {
                        //sound.pitch=1;
                        sound.Stop();
                    }
                }
            }
        }

        //Postprocessing
        postProcessVolume = FindObjectOfType <PostProcessVolume>();
        if (SaveSerial.instance != null)
        {
            if (SaveSerial.instance.settingsData.pprocessing == true && postProcessVolume != null)
            {
                postProcessVolume.GetComponent <PostProcessVolume>().enabled = true;
            }
            if (SaveSerial.instance.settingsData.pprocessing == false && FindObjectOfType <PostProcessVolume>() != null)
            {
                postProcessVolume = FindObjectOfType <PostProcessVolume>(); postProcessVolume.GetComponent <PostProcessVolume>().enabled = false;
            }
        }


        CheckCodes(0, 0);
    }
예제 #19
0
    //<summary>
    //Initializes the state at start
    //Grabs the default values and stores them into the appropriate variables
    //</summary>
    void Start()
    {
        //Set up the post processing on the camera
#if UNITY_POST_PROCESSING_STACK_V1
        if (gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>() == null)
        {
            gameObjects.mainCamera.AddComponent <PostProcessingBehaviour>();
        }

        postProcessing = gameObjects.mainCamera.GetComponent <PostProcessingBehaviour>();
#endif

#if UNITY_POST_PROCESSING_STACK_V2 && UNITY_EDITOR
        if (gameObjects.mainCamera.GetComponent <PostProcessLayer>() == null)
        {
            EditorUtility.DisplayDialog("No Post Process Layer detected", "The camera object is missing a Post Process Layer and a Post Process Volume. In the Editor AQUAS will try to add them when entering play mode. However it is recommended that you add them manually before entering playmode, or else they will be missing in the build.", "Got It!");

            gameObjects.mainCamera.AddComponent <PostProcessLayer>();

            postProcessing = gameObjects.mainCamera.GetComponent <PostProcessLayer>();
            PostProcessResources resources;

            if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)) != null)
            {
                resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources));
            }
            else if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources)) != null)
            {
                resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing/PostProcessResources.asset", typeof(PostProcessResources));
            }
            else if ((PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessResources.asset", typeof(PostProcessResources)) != null)
            {
                resources = (PostProcessResources)AssetDatabase.LoadAssetAtPath("Assets/PostProcessing-2/PostProcessResources.asset", typeof(PostProcessResources));
            }
            else
            {
                EditorUtility.DisplayDialog("Could not locate Post Process Resource file.", "Please make sure your post processing folder is at the top level of the assets folder and named either 'PostProcessing' or 'PostProcessing-2'", "Got It!");
                resources = null;
            }


            postProcessing.Init(resources);

            postProcessing.volumeTrigger = gameObjects.mainCamera.transform;
            postProcessing.volumeLayer   = LayerMask.NameToLayer("Everything");
        }

        if (gameObjects.mainCamera.GetComponent <PostProcessVolume>() == null)
        {
            gameObjects.mainCamera.AddComponent <PostProcessVolume>();
            gameObjects.mainCamera.GetComponent <PostProcessVolume>().isGlobal = true;
        }

        postProcessingVolume = gameObjects.mainCamera.GetComponent <PostProcessVolume>();
#endif


#if UNITY_EDITOR
#if UNITY_POST_PROCESSING_STACK_V1 || UNITY_POST_PROCESSING_STACK_V2
        if (underWaterParameters.defaultProfile == null)
        {
            EditorUtility.DisplayDialog("WARNING! - Post default post processing profile missing!", "The post processing profiles in the inspector of the underwater camera effects are missing a default profile! It's not recommended to leave the default profile empty. If you don't want to use post processing while afloat, you can use a profile with all image effects disabled", "Got it!");
        }
#endif
#endif

        waterLensAudio = gameObjects.waterLens.GetComponent <AudioSource>();
        airLensAudio   = gameObjects.airLens.GetComponent <AudioSource>();
        audioComp      = GetComponent <AudioSource>();
        cameraAudio    = gameObjects.mainCamera.GetComponent <AudioSource>();

        bubbleBehaviour = gameObjects.bubble.GetComponent <AQUAS_BubbleBehaviour>();

        //Set initially active lenses
        gameObjects.airLens.SetActive(true);
        gameObjects.waterLens.SetActive(false);

        //Assign materials
        //waterLensMaterial = gameObjects.waterLens.GetComponent<Renderer> ().material;
        airLensMaterial = gameObjects.airLens.GetComponent <Renderer> ().material;

        waterPlaneMaterial = gameObjects.waterPlanes[0].GetComponent <Renderer> ().material;

        t  = wetLens.wetTime + wetLens.dryingTime;
        t2 = 0;
        bubbleSpawnTimer = 0;

        //Initialize default values for ---
        //--- global fog
        defaultFog        = RenderSettings.fog;
        defaultFogDensity = RenderSettings.fogDensity;
        defaultFogColor   = RenderSettings.fogColor;

        /*if (globalFog != null)
         * {
         *  globalFog.enabled = defaultFog;
         * }*/

        //--- Some water parameters
        defaultFoamContrast = waterPlaneMaterial.GetFloat("_FoamContrast");
        defaultSpecularity  = waterPlaneMaterial.GetFloat("_Specular");

        if (waterPlaneMaterial.HasProperty("_Refraction"))
        {
            defaultRefraction = waterPlaneMaterial.GetFloat("_Refraction");
        }

#if UNITY_POST_PROCESSING_STACK_V1
        postProcessing.profile = underWaterParameters.defaultProfile;
#endif

#if UNITY_POST_PROCESSING_STACK_V2
        postProcessingVolume.profile = underWaterParameters.defaultProfile;
#endif

        audioComp.clip = soundEffects.sounds[0];
        audioComp.loop = true;
        audioComp.Stop();
        airLensAudio.clip = soundEffects.sounds[1];
        airLensAudio.loop = false;
        airLensAudio.Stop();
        waterLensAudio.clip = soundEffects.sounds[2];
        waterLensAudio.loop = false;
        waterLensAudio.Stop();

        //Check if Tenkoku is in the scene
        if (GameObject.Find("Tenkoku DynamicSky") != null)
        {
            tenkokuObj = GameObject.Find("Tenkoku DynamicSky");
        }
    }
예제 #21
0
 private void Awake()
 {
     ppProfile = FindObjectOfType <PostProcessVolume>();
     ppLayer   = FindObjectOfType <PostProcessLayer>();
 }
예제 #22
0
        /// <summary>
        /// Enables the input profile for the currently rendering scene (menu, ksc, editor, tracking, flight, flight-map)
        /// </summary>
        /// <param name="profileName"></param>
        internal void enableProfile(string profileName)
        {
            currentProfile = null;
            Camera activeCam = getActiveCamera();

            Log.debug("TUFX: enableProfile( " + profileName + " )  scene: ( " + HighLogic.LoadedScene + " ) map: ( " + isMapScene + " ) camera: ( " + activeCam?.name + " )");
            Log.debug(System.Environment.StackTrace);
            if (previousCamera != activeCam)
            {
                Log.log("Detected change of active camera; recreating post-process objects.");
                if (volume != null)
                {
                    Log.log("Destroying existing PostProcessVolume (from previous camera).");
                    Component.DestroyImmediate(layer);
                    UnityEngine.Object.DestroyImmediate(volume.sharedProfile);
                    UnityEngine.Object.DestroyImmediate(volume);
                    layer  = null;
                    volume = null;
                }
                previousScene  = HighLogic.LoadedScene;
                wasMapScene    = isMapScene;
                previousCamera = activeCam;
            }

            Log.debug("Active Camera (hashcode): " + activeCam?.GetHashCode());
            if (activeCam == null)
            {
                Log.log("Active camera was null.  Skipping profile setup for scene: " + HighLogic.LoadedScene);
            }
            else if (!string.IsNullOrEmpty(profileName) && Profiles.ContainsKey(profileName))
            {
                Log.log("Enabling profile: " + profileName + ".  Current GameScene: " + HighLogic.LoadedScene);
                TUFXProfile tufxProfile = Profiles[profileName];
                currentProfile = tufxProfile;
                Log.debug("Profile (hashcode): " + tufxProfile?.GetHashCode() + " :: " + tufxProfile?.ProfileName);
                Log.log("Setting HDR for camera: " + activeCam.name + " to: " + tufxProfile.HDREnabled);
                activeCam.allowHDR = tufxProfile.HDREnabled;
                onAntiAliasingSelected(tufxProfile.AntiAliasing, false);
                layer = activeCam.gameObject.AddOrGetComponent <PostProcessLayer>();
                layer.Init(Resources);
                layer.volumeLayer = ~0;//everything //TODO -- fix layer assignment...
                Log.debug("Layer: " + layer?.GetHashCode());
                volume          = activeCam.gameObject.AddOrGetComponent <PostProcessVolume>();
                volume.isGlobal = true;
                volume.priority = 100;
                Log.debug("Volume: " + volume.GetHashCode());
                if (volume.sharedProfile == null)
                {
                    volume.sharedProfile = tufxProfile.GetPostProcessProfile();
                }
                else
                {
                    volume.sharedProfile.settings.Clear();
                    tufxProfile.Enable(volume);
                }
                Log.log("Profile enabled: " + profileName);
                TUFXScatteringManager.INSTANCE.debugProfileSetup(volume, layer);
            }
            else if (string.IsNullOrEmpty(profileName))
            {
                Log.log("Clearing current profile for scene: " + HighLogic.LoadedScene);
            }
            else
            {
                Log.exception("Profile load was requested for: " + profileName + ", but no profile exists for that name.");
            }
        }
예제 #24
0
 private void Awake()
 {
     volume = GetComponent <PostProcessVolume>();
 }
예제 #25
0
        public override void OnLoad()
        {
            base.OnLoad();
            equipmentDef.name = "MysticsItems_GateChalice";
            ConfigManager.Balance.CreateEquipmentCooldownOption(equipmentDef, "Equipment: Gate Chalice", 60f);
            equipmentDef.canDrop = true;
            ConfigManager.Balance.CreateEquipmentEnigmaCompatibleOption(equipmentDef, "Equipment: Gate Chalice", false);
            ConfigManager.Balance.CreateEquipmentCanBeRandomlyTriggeredOption(equipmentDef, "Equipment: Gate Chalice", false);
            equipmentDef.isLunar           = true;
            equipmentDef.colorIndex        = ColorCatalog.ColorIndex.LunarItem;
            equipmentDef.pickupModelPrefab = PrepareModel(Main.AssetBundle.LoadAsset <GameObject>("Assets/Equipment/Gate Chalice/Model.prefab"));
            equipmentDef.pickupIconSprite  = Main.AssetBundle.LoadAsset <Sprite>("Assets/Equipment/Gate Chalice/Icon.png");

            Material mat = equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").gameObject.GetComponent <MeshRenderer>().sharedMaterial;

            HopooShaderToMaterial.Standard.Apply(mat);
            HopooShaderToMaterial.Standard.Gloss(mat, 0.5f);
            HopooShaderToMaterial.Standard.Emission(mat, 0.02f, new Color(48f / 255f, 127f / 255f, 255f / 255f));
            foreach (Transform lightTransform in equipmentDef.pickupModelPrefab.transform.Find("mdlGateChalice").Find("Lights"))
            {
                SetScalableChildEffect(equipmentDef.pickupModelPrefab, lightTransform.gameObject);
                FlickerLight flickerLight = lightTransform.gameObject.AddComponent <FlickerLight>();
                flickerLight.light    = lightTransform.gameObject.GetComponent <Light>();
                flickerLight.sinWaves = new Wave[] {
                    new Wave {
                        amplitude = 0.3f,
                        frequency = 4f
                    },
                    new Wave {
                        amplitude = 0.6f,
                        frequency = 2f
                    },
                    new Wave {
                        amplitude = 0.9f,
                        frequency = 1f
                    }
                };
            }
            itemDisplayPrefab = PrepareItemDisplayModel(PrefabAPI.InstantiateClone(equipmentDef.pickupModelPrefab, equipmentDef.pickupModelPrefab.name + "Display", false));
            onSetupIDRS      += () =>
            {
                AddDisplayRule("CommandoBody", "Stomach", new Vector3(-0.09F, 0.1F, -0.102F), new Vector3(5.862F, 140.357F, 1.915F), new Vector3(0.059F, 0.059F, 0.059F));
                AddDisplayRule("HuntressBody", "Pelvis", new Vector3(-0.082F, -0.111F, 0.085F), new Vector3(0.679F, 36.762F, 188.148F), new Vector3(0.047F, 0.047F, 0.048F));
                AddDisplayRule("Bandit2Body", "Stomach", new Vector3(-0.096F, 0.027F, -0.151F), new Vector3(337.162F, 337.663F, 11.532F), new Vector3(0.04F, 0.04F, 0.04F));
                AddDisplayRule("ToolbotBody", "Hip", new Vector3(-1.239F, 0.577F, -1.044F), new Vector3(0F, 180F, 180F), new Vector3(0.349F, 0.349F, 0.349F));
                AddDisplayRule("EngiBody", "Pelvis", new Vector3(-0.178F, 0.078F, 0.157F), new Vector3(11.745F, 186.295F, 185.936F), new Vector3(0.047F, 0.047F, 0.047F));
                AddDisplayRule("MageBody", "Pelvis", new Vector3(-0.128F, -0.131F, 0.024F), new Vector3(6.286F, 3.408F, 167.572F), new Vector3(0.044F, 0.044F, 0.044F));
                AddDisplayRule("MercBody", "Chest", new Vector3(0F, 0.193F, -0.286F), new Vector3(71.925F, 180F, 0F), new Vector3(0.027F, 0.027F, 0.027F));
                AddDisplayRule("TreebotBody", "FlowerBase", new Vector3(-0.485F, 0.701F, -0.803F), new Vector3(26.173F, 24.306F, 86.838F), new Vector3(0.061F, 0.061F, 0.061F));
                AddDisplayRule("LoaderBody", "Pelvis", new Vector3(-0.216F, -0.016F, -0.022F), new Vector3(342.363F, 183.205F, 159.555F), new Vector3(0.045F, 0.045F, 0.045F));
                AddDisplayRule("CrocoBody", "SpineStomach1", new Vector3(0.845F, 0.495F, 1.289F), new Vector3(74.633F, 327.618F, 247.859F), new Vector3(0.361F, 0.361F, 0.361F));
                AddDisplayRule("CaptainBody", "Stomach", new Vector3(-0.195F, 0.128F, 0.126F), new Vector3(336.504F, 156.734F, 358.159F), new Vector3(0.041F, 0.041F, 0.041F));
                AddDisplayRule("ScavBody", "MuzzleEnergyCannon", new Vector3(0F, 0F, -1.503F), new Vector3(90F, 0F, 0F), new Vector3(2.281F, 2.281F, 2.281F));
                AddDisplayRule("EquipmentDroneBody", "GunBarrelBase", new Vector3(0F, 0F, 1.069F), new Vector3(0F, 0F, 0F), new Vector3(0.267F, 0.267F, 0.267F));
                if (SoftDependencies.SoftDependenciesCore.itemDisplaysSniper)
                {
                    AddDisplayRule("SniperClassicBody", "Pelvis", new Vector3(0.19432F, 0.18834F, -0.17385F), new Vector3(343.5044F, 339.549F, 357.2065F), new Vector3(0.05181F, 0.05181F, 0.05181F));
                }
                AddDisplayRule("RailgunnerBody", "Pelvis", new Vector3(0.14878F, -0.03065F, 0.10522F), new Vector3(354.5591F, 180F, 180F), new Vector3(0.05639F, 0.05639F, 0.05639F));
                AddDisplayRule("VoidSurvivorBody", "Hand", new Vector3(-0.03581F, 0.28639F, -0.00539F), new Vector3(0F, 0F, 4.98446F), new Vector3(0.09781F, 0.09781F, 0.09781F));
            };

            visualEffectOnUse = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceOnUseEffect", false);
            EffectComponent effectComponent = visualEffectOnUse.AddComponent <EffectComponent>();

            effectComponent.soundName = "Play_env_teleporter_active_button";
            effectComponent.positionAtReferencedTransform = true;
            effectComponent.applyScale      = true;
            effectComponent.disregardZScale = true;
            VFXAttributes vfxAttributes = visualEffectOnUse.AddComponent <VFXAttributes>();

            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Low;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Low;
            visualEffectOnUse.AddComponent <DestroyOnTimer>().duration = 2f;

            GameObject     massSparks     = PrefabAPI.InstantiateClone(new GameObject(), "MassSparks", false);
            ParticleSystem particleSystem = massSparks.AddComponent <ParticleSystem>();

            massSparks.GetComponent <ParticleSystemRenderer>().material = Object.Instantiate(LegacyResourcesAPI.Load <GameObject>("Prefabs/Effects/ActivateRadarTowerEffect").transform.Find("MassSparks").gameObject.GetComponent <ParticleSystemRenderer>().material);
            particleSystem.useAutoRandomSeed = true;
            ParticleSystem.MainModule mainModule = particleSystem.main;
            mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
            mainModule.scalingMode     = ParticleSystemScalingMode.Local;
            mainModule.startLifetime   = 5f;
            mainModule.duration        = 1f;
            mainModule.playOnAwake     = true;
            ParticleSystem.MinMaxCurve particleSpeed = mainModule.startSpeed;
            particleSpeed.mode         = ParticleSystemCurveMode.TwoConstants;
            particleSpeed.constantMin  = 10f;
            particleSpeed.constantMax  = 1000f;
            mainModule.startSize       = 0.1f;
            mainModule.startColor      = new Color(48f / 255f, 127f / 255f, 255f / 255f);
            mainModule.gravityModifier = 0.3f;
            mainModule.maxParticles    = 20;
            ParticleSystem.EmissionModule emissionModule = particleSystem.emission;
            emissionModule.enabled          = true;
            emissionModule.rateOverTime     = 10;
            emissionModule.rateOverDistance = 0;
            emissionModule.SetBursts(new ParticleSystem.Burst[]
            {
                new ParticleSystem.Burst
                {
                    time           = 0f,
                    count          = 20f,
                    cycleCount     = 1,
                    repeatInterval = 0.01f,
                    probability    = 1f
                }
            });
            ParticleSystem.ShapeModule shapeModule = particleSystem.shape;
            shapeModule.shapeType = ParticleSystemShapeType.Sphere;
            massSparks.transform.SetParent(visualEffectOnUse.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectOnUse);

            visualEffectTeleportOut    = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceTeleportOutEffect", false);
            effectComponent            = visualEffectTeleportOut.AddComponent <EffectComponent>();
            vfxAttributes              = visualEffectTeleportOut.AddComponent <VFXAttributes>();
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.Medium;
            visualEffectTeleportOut.AddComponent <DestroyOnTimer>().duration = 4f;

            GameObject ppHolder = PrefabAPI.InstantiateClone(new GameObject(), "PP", false);

            ppHolder.layer = LayerIndex.postProcess.intVal;
            ppHolder.AddComponent <MysticsItemsGateChalicePPController>().time = 3f;
            PostProcessVolume pp = ppHolder.AddComponent <PostProcessVolume>();

            pp.isGlobal = true;
            pp.weight   = 0f;
            pp.priority = 50;
            PostProcessProfile ppProfile = ScriptableObject.CreateInstance <PostProcessProfile>();

            ppProfile.name = "ppGateChalice";
            LensDistortion lensDistortion = ppProfile.AddSettings <LensDistortion>();

            lensDistortion.SetAllOverridesTo(true);
            lensDistortion.intensity.value = -100f;
            lensDistortion.scale.value     = 1f;
            ColorGrading colorGrading = ppProfile.AddSettings <ColorGrading>();

            colorGrading.colorFilter.value         = new Color(97f / 255f, 163f / 255f, 239f / 255f);
            colorGrading.colorFilter.overrideState = true;
            pp.sharedProfile = ppProfile;
            ppHolder.transform.SetParent(visualEffectTeleportOut.transform);

            MysticsItemsContent.Resources.effectPrefabs.Add(visualEffectTeleportOut);

            SceneExitController sceneExitController = sceneExitControllerObject.AddComponent <SceneExitController>();

            sceneExitController.useRunNextStageScene = true;
            sceneExitControllerObject.AddComponent <MysticsItemsGateChaliceSceneExit>();

            itemDestroyEffectPrefab = PrefabAPI.InstantiateClone(new GameObject(), "MysticsItems_GateChaliceItemDestroyEffect", false);
            EntityStateMachine entityStateMachine = itemDestroyEffectPrefab.AddComponent <EntityStateMachine>();

            entityStateMachine.initialStateType = entityStateMachine.mainStateType = new EntityStates.SerializableEntityStateType(typeof(MysticsItemsGateChaliceItemDestroyEffect));
            PickupDisplay pickupDisplay = itemDestroyEffectPrefab.AddComponent <PickupDisplay>();
            Rigidbody     rigidbody     = itemDestroyEffectPrefab.AddComponent <Rigidbody>();

            rigidbody.useGravity       = false;
            rigidbody.drag             = 2f;
            effectComponent            = itemDestroyEffectPrefab.AddComponent <EffectComponent>();
            effectComponent.applyScale = true;
            effectComponent.soundName  = "Play_moonBrother_phase4_itemSuck_returnSingle";
            vfxAttributes = itemDestroyEffectPrefab.AddComponent <VFXAttributes>();
            vfxAttributes.vfxIntensity = VFXAttributes.VFXIntensity.High;
            vfxAttributes.vfxPriority  = VFXAttributes.VFXPriority.Always;
            Highlight highlight = itemDestroyEffectPrefab.AddComponent <Highlight>();

            pickupDisplay.highlight  = highlight;
            highlight.highlightColor = Highlight.HighlightColor.pickup;
            MysticsItemsContent.Resources.effectPrefabs.Add(itemDestroyEffectPrefab);
        }
예제 #26
0
        public static EffectSuite FromVolume(PostProcessVolume post_volume)
        {
            if (post_volume == null)
            {
                Logger.Debug("Post_volume is null in EffectSuite.FromVolume");
                return(null);
            }

            var    suite     = new EffectSuite();
            string not_found = "";

            if ((suite.AO = post_volume.profile.GetSetting <AmbientOcclusion>()) == null)
            {
                not_found += "ao,";
                suite.AO   = post_volume.profile.AddSettings <AmbientOcclusion>();
                suite.AO.enabled.Override(false);
            }
            if ((suite.EXPO = post_volume.profile.GetSetting <AutoExposure>()) == null)
            {
                not_found += "expo,";
                suite.EXPO = post_volume.profile.AddSettings <AutoExposure>();
                suite.EXPO.enabled.Override(false);
            }
            if ((suite.BLOOM = post_volume.profile.GetSetting <Bloom>()) == null)
            {
                not_found  += "bloom,";
                suite.BLOOM = post_volume.profile.AddSettings <Bloom>();
                suite.BLOOM.enabled.Override(false);
            }
            if ((suite.CA = post_volume.profile.GetSetting <ChromaticAberration>()) == null)
            {
                not_found += "ca,";
                suite.CA   = post_volume.profile.AddSettings <ChromaticAberration>();
                suite.CA.enabled.Override(false);
            }
            if ((suite.COLOR = post_volume.profile.GetSetting <ColorGrading>()) == null)
            {
                not_found  += "color,";
                suite.COLOR = post_volume.profile.AddSettings <ColorGrading>();
                suite.COLOR.enabled.Override(false);
            }
            if ((suite.DOF = post_volume.profile.GetSetting <DepthOfField>()) == null)
            {
                not_found += "dof,";
                suite.DOF  = post_volume.profile.AddSettings <DepthOfField>();
                suite.DOF.enabled.Override(false);
            }
            if ((suite.GRAIN = post_volume.profile.GetSetting <Grain>()) == null)
            {
                not_found  += "grain,";
                suite.GRAIN = post_volume.profile.AddSettings <Grain>();
                suite.GRAIN.enabled.Override(false);
            }
            if ((suite.BLUR = post_volume.profile.GetSetting <MotionBlur>()) == null)
            {
                not_found += "blur,";
                suite.BLUR = post_volume.profile.AddSettings <MotionBlur>();
                suite.BLUR.enabled.Override(false);
            }
            if ((suite.LENS = post_volume.profile.GetSetting <LensDistortion>()) == null)
            {
                not_found += "lens,";
                suite.LENS = post_volume.profile.AddSettings <LensDistortion>();
                suite.LENS.enabled.Override(false);
            }
            if ((suite.REFL = post_volume.profile.GetSetting <ScreenSpaceReflections>()) == null)
            {
                not_found += "refl,";
                suite.REFL = post_volume.profile.AddSettings <ScreenSpaceReflections>();
                suite.REFL.enabled.Override(false);
            }
            if ((suite.VIGN = post_volume.profile.GetSetting <Vignette>()) == null)
            {
                not_found += "vign,";
                suite.VIGN = post_volume.profile.AddSettings <Vignette>();
                suite.VIGN.enabled.Override(false);
            }

            if (not_found.Length > 0)
            {
                Logger.Debug("Not found: " + not_found);
            }

            return(suite);
        }
예제 #27
0
    public void Start()
    {
        #region Setup

        goPostProcessing = DontDestroy.DontDestroyObjects[0]; // Referencing by index[0] seems too abstract

        if (goPostProcessing == null)
        {
            Debug.Log("Post Processing has to be loaded from the 'Menu' scene first.");
        }
        else
        {
            ppVolume = goPostProcessing.GetComponent <PostProcessVolume>();

            PostProcessProfile ppProfile = ppVolume.profile;

            ppProfile.TryGetSettings(out ppBloom);
            ppProfile.TryGetSettings(out ppVignette);
        }

        GameObject goMenuMusic = GameObject.Find("Menu Music");
        GameObject goGameMusic = GameObject.Find("Game Music");

        goMusic          = goMenuMusic == null ? goGameMusic : goMenuMusic;
        musicAudioSource = goMusic.GetComponent <AudioSource>();

        if (goPostProcessing == null || goMusic == null)
        {
            Debug.Log(goPostProcessing == null ? "Post Processing is not loaded." : "Post Processing is loaded.");
            Debug.Log(goMusic == null ? "Music is not loaded." : "Music is loaded.");
            return;
        }

        // --Msc--
        // Vignette
        uiToggleVignette = new UIToggle(ToggleVignette);
        uiSliderVignette = new UISlider(SliderVignette);

        // Bloom
        uiToggleBloom = new UIToggle(ToggleBloom);
        uiSliderBloom = new UISlider(SliderBloom);

        // Fullscreen
        uiToggleFullscreen = new UIToggle(ToggleFullscreen);
        // VSync
        uiToggleVSync = new UIToggle(ToggleVSync);

        // Resolutions
        uiDropdownResolution = new UIDropdown(DropdownResolution);
        InitializeResolutionsDropDown();

        // Quality
        uiDropdownQuality = new UIDropdown(DropdownQuality);
        InitializeQualityDropDown();

        // --Volume--
        // Volume
        uiSliderVolumeMusic = new UISlider(SliderVolumeMusic);
        uiSliderVolumeSFX   = new UISlider(SliderVolumeSFX);

        // --Game--
        // Camera
        uiSliderSensitivityZoom = new UISlider(SliderSensitivityZoom);
        uiSliderSensitivityPan  = new UISlider(SliderSensitivityPan);

        buttonResetToDefaults = new UIButton(ButtonResetToDefaults);
        buttonResetToDefaults.AddListener(() =>
        {
            ResetToDefaults();
        });

        buttonBackToMenu = new UIButton(ButtonBackToMenu);
        buttonBackToMenu.AddListener(() =>
        {
            if (SceneManager.GetActiveScene().name == "Options")
            {
                SceneManager.LoadScene("Menu");
            }
            else
            {
                UIListener.InOptions = false;
                UIListener.MenuMain.SetActive(true);
                UIListener.MenuOptions.SetActive(false);
            }
        });

        buttonGoToControls = new UIButton(ButtonControls);
        buttonGoToControls.AddListener(() =>
        {
            inControls = !inControls;
            OptionsGeneral.SetActive(!inControls);
            OptionsControls.SetActive(inControls);
        });

        buttonGoToOptionsGeneral = new UIButton(ButtonBackToOptionsGeneral);
        buttonGoToOptionsGeneral.AddListener(() =>
        {
            inControls = !inControls;
            OptionsGeneral.SetActive(!inControls);
            OptionsControls.SetActive(inControls);
        });

        hotkeyEscape = new UIHotkey(HotkeyEscape);

        #endregion Setup

        InitializeUIValues();
        InitializePlayerPrefs();
        InitializeOptionValues();
    }
예제 #28
0
 void SetupVolume()
 {
     postProcessVolume          = GetComponent <PostProcessVolume>();
     postProcessVolume.isGlobal = true;
 }
예제 #29
0
    // Start is called before the first frame update
    void Start()
    {
        gustSpeed = Random.Range(minGustDuration, maxGustDuration);
        StartCoroutine(SetGustIntensity());
        snowing = false;
        SetSnowIntensity(0);
        strikeZones    = GameObject.FindGameObjectsWithTag("strikeZone");
        openedUmbrella = false;
        closedUmbrella = true;
        SetRainMultiplier(0);

        precipCo = StartCoroutine(PrecipitationLoop());

        PostProcessVolume volume = secondCamera.GetComponent <PostProcessVolume>();

        volume.profile.TryGetSettings(out cg);
        PostProcessVolume volumeMain = mainCam.GetComponent <PostProcessVolume>();

        volumeMain.profile.TryGetSettings(out vig);
        volumeMain.profile.TryGetSettings(out bloom);
        volumeMain.profile.TryGetSettings(out dof);
        inCutscene      = false;
        theUIController = FindObjectOfType <UIController>();
        theAudioManager = FindObjectOfType <AudioManager>();

        //Show cutscene
        if (!PlayerPrefs.HasKey("showCutscene") || PlayerPrefs.GetInt("showCutscene") == 1)
        {
            inCutscene = true;
            GameObject cutScene = Instantiate(cutSceneObj, cutsceneSpawnPoint.transform.position, cutsceneSpawnPoint.transform.rotation);
            cutScene.transform.localScale = cutsceneSpawnPoint.transform.localScale;
            theUIController.HideStartScreen();
            theAudioManager.StartCoroutine(theAudioManager.FadeInSound(theAudioManager.cutsceneMusic, 1, 1));
        }

        else
        {
            theUIController.ShowStartScreen();
        }


        starAnim = new Animator[3];


        sawStartScreen    = false;
        theStackSpawner   = FindObjectOfType <StackSpawner>();
        theScoreManager   = FindObjectOfType <ScoreManager>();
        theShipController = FindObjectOfType <ShipController>();
        inGame            = false;
        canCelebrate      = true;

        if (!PlayerPrefs.HasKey("lastBeatenLevel"))
        {
            PlayerPrefs.SetInt("lastBeatenLevel", 0);
        }


        for (int i = 0; i < 3; i++)
        {
            starAnim[i] = theUIController.starImages[i].GetComponent <Animator>();
        }


        SetSkyColor(skyCol.Evaluate(0));
        SetEquatorColor(eqCol.Evaluate(0));
        SetGroundColor(grColor.Evaluate(0));

        //PlayerPrefs.DeleteAll();
    }
예제 #30
0
        /// <summary>
        /// Creates and returns a Tween for the informed component.
        /// The Tween is configured based on the attribute values of this TweenData file.
        /// </summary>
        /// <param name="transform"></param>
        /// <returns></returns>
        public Tween GetTween(PostProcessVolume volume)
        {
            var setting = volume.profile.GetSetting <ColorGrading>();

            if (setting != null)
            {
                setting.active = automaticOverride;
                switch (command)
                {
                case ColorGradingCommand.Temperature:
                    setting.temperature.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.temperature.value, x => setting.temperature.value = x, to, duration));

                case ColorGradingCommand.Tint:
                    setting.tint.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.tint.value, x => setting.tint.value = x, to, duration));

                case ColorGradingCommand.PostExposure:
                    setting.postExposure.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.postExposure.value, x => setting.postExposure.value = x, to, duration));

                case ColorGradingCommand.ColorFilter:
                    setting.colorFilter.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.colorFilter.value, x => setting.colorFilter.value = x, color, duration));

                case ColorGradingCommand.Saturation:
                    setting.saturation.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.saturation.value, x => setting.saturation.value = x, to, duration));

                case ColorGradingCommand.Contrast:
                    setting.contrast.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.contrast.value, x => setting.contrast.value = x, to, duration));

                case ColorGradingCommand.RedMixerRed:
                    setting.mixerRedOutRedIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerRedOutRedIn.value, x => setting.mixerRedOutRedIn.value = x, to, duration));

                case ColorGradingCommand.RedMixerGreen:
                    setting.mixerRedOutGreenIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerRedOutGreenIn.value, x => setting.mixerRedOutGreenIn.value = x, to, duration));

                case ColorGradingCommand.RedMixerBlue:
                    setting.mixerRedOutBlueIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerRedOutBlueIn.value, x => setting.mixerRedOutBlueIn.value = x, to, duration));

                case ColorGradingCommand.GreenMixerRed:
                    setting.mixerGreenOutRedIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerGreenOutRedIn.value, x => setting.mixerGreenOutRedIn.value = x, to, duration));

                case ColorGradingCommand.GreenMixerGreen:
                    setting.mixerGreenOutGreenIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerGreenOutGreenIn.value, x => setting.mixerGreenOutGreenIn.value = x, to, duration));

                case ColorGradingCommand.GreenMixerBlue:
                    setting.mixerGreenOutBlueIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerGreenOutBlueIn.value, x => setting.mixerGreenOutBlueIn.value = x, to, duration));

                case ColorGradingCommand.BlueMixerRed:
                    setting.mixerBlueOutRedIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerBlueOutRedIn.value, x => setting.mixerBlueOutRedIn.value = x, to, duration));

                case ColorGradingCommand.BlueMixerGreen:
                    setting.mixerBlueOutGreenIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerBlueOutGreenIn.value, x => setting.mixerBlueOutGreenIn.value = x, to, duration));

                case ColorGradingCommand.BlueMixerBlue:
                    setting.mixerBlueOutBlueIn.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.mixerBlueOutBlueIn.value, x => setting.mixerBlueOutBlueIn.value = x, to, duration));

                case ColorGradingCommand.Lift:
                    setting.lift.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.lift.value, x => setting.lift.value = x, vector, duration));

                case ColorGradingCommand.Gamma:
                    setting.gamma.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.gamma.value, x => setting.gamma.value = x, vector, duration));

                case ColorGradingCommand.Gain:
                    setting.gamma.overrideState = automaticOverride;
                    return(DOTween.To(() => setting.gamma.value, x => setting.gamma.value = x, vector, duration));
                }
            }
            else
            {
                Debug.Log("UniTween could not find a Color Grading to tween. Be sure to add it on your Post Process Volume component");
            }

            return(null);
        }