Esempio 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");
        }
    }
Esempio 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);
            }
        }
    }