Ejemplo n.º 1
0
    public void switchDimension(int dimension)
    {
        //Debug.Log("Switching to " + dimension);

        CameraEffectsMaster.fovPunch(5, 0.25f);

        for (int i = 0; i < dimensions.Length; i++)
        {
            if (i == dimension)
            {
                CameraEffectsMaster.setVolumeweight(dimensionVolumeIndex[i], 1);
            }
            else
            {
                CameraEffectsMaster.setVolumeweight(dimensionVolumeIndex[i], 0);
            }
        }

        if (dimension >= 0 && dimension < dimensions.Length)
        {
            foreach (DSwitchable switchO in switchables)
            {
                switchO.switchTo(dimension);
            }
        }
        else
        {
            Debug.LogWarning("tried to switch to an invalid dimesion");
        }
    }
Ejemplo n.º 2
0
    //maybe add min entry velocity or set speed instead of add force

    private void OnTriggerEnter(Collider other)
    {
        Rigidbody rigid = other.GetComponent <Rigidbody>();

        if (rigid != null)
        {
            Vector3 direction = Vector3.Project(rigid.velocity, transform.forward).normalized;//go forwars or backwards?
            if (direction.magnitude == 0)
            {
                direction = transform.forward;
            }
            rigid.AddForce(direction * force + Vector3.up * additionalVerticalForce);

            PlayerControllerRefactored player = other.GetComponent <PlayerControllerRefactored>();
            if (player != null)
            {
                CameraEffectsMaster.fovPunch((force + additionalVerticalForce) / 2000 * fovForceMultiplier, (force + additionalVerticalForce) / 20000 * fovTimeMultiplier);
            }
        }
    }
Ejemplo n.º 3
0
    private void Start()//register all dimensions to the camera effects
    {
        //switchables = GameObject.FindObjectsOfType<DSwitchable>().ToList<DSwitchable>();

        if (dimensions.Length == 0)
        {
            Debug.LogError("There are no dimensions to shift to");
        }

        dimensionVolumeIndex = new int[dimensions.Length];
        for (int i = 0; i < dimensionVolumeIndex.Length; i++)
        {
            Effect effect = new Effect();
            effect.ppProfile        = dimensions[i].postProcessingVolume;
            effect.fogColor         = dimensions[i].fogColor;
            dimensionVolumeIndex[i] = CameraEffectsMaster.addEffect(effect);
        }

        switchDimension(0);
    }
Ejemplo n.º 4
0
    /*
     * private void OnLevelWasLoaded(int level)
     * {
     *  reload();
     * }
     */

    public void reload()//basically singleton
    {
        //not a "real" singleton, because plans change and player doesnt want its master to die

        /*if (instance == null)*/
        instance = this;
        //else Destroy(this);


        CameraEffectsMaster[] masters = GameObject.FindObjectsOfType <CameraEffectsMaster>();
        if (masters.Length > 1)
        {
            Debug.LogWarning("There are multiple cameraEffectsMasters, disabled all, but " + name);
            for (int i = 0; i < masters.Length; i++)
            {
                if (masters[i] != this)
                {
                    masters[i].enabled = false;
                }
            }
        }

        cameraEffects = GameObject.FindObjectsOfType <CameraEffects>();

        //outdated

        /*
         * if (this == instance)
         * {
         *  GameObject gObject = new GameObject("dimensionPostprocessVolume");
         *  gObject.transform.parent = transform;
         *  gObject.layer = 8;//post processing
         *  ppVolume = gObject.AddComponent<PostProcessVolume>();
         *  colorGrading = ppVolume.profile.AddSettings<ColorGrading>();
         *  ppVolume.isGlobal = true;
         *  ppVolume.priority = 2;
         *  ppVolume.weight = 1;
         * }
         */
    }