public void Initialize(CameraController3 cameraController, Ragdoll ragdoll)
    {
        this.cameraController = cameraController;
        ClearMaterials();
        Dictionary <Material, Material> dictionary = new Dictionary <Material, Material>();

        Renderer[] componentsInChildren = ragdoll.GetComponentsInChildren <Renderer>();
        for (int i = 0; i < componentsInChildren.Length; i++)
        {
            Material[] sharedMaterials = componentsInChildren[i].sharedMaterials;
            for (int j = 0; j < sharedMaterials.Length; j++)
            {
                if ("Standard".Equals(sharedMaterials[j].shader.name) && sharedMaterials[j].GetFloat("_Mode") != 3f)
                {
                    Material value = null;
                    if (!dictionary.TryGetValue(sharedMaterials[j], out value))
                    {
                        value = new Material(sharedMaterials[j]);
                        dictionary[sharedMaterials[j]] = value;
                        materials.Add(value);
                    }
                    sharedMaterials[j] = value;
                }
            }
            componentsInChildren[i].sharedMaterials = sharedMaterials;
        }
    }
Ejemplo n.º 2
0
 public void OnDisable()
 {
     for (int i = 0; i < sensors.Count; i++)
     {
         sensors[i].OnLeaveBody(waterBody);
     }
     sensors.Clear();
     if (NetGame.isClient)
     {
         cameraController  = null;
         cameraWaterSensor = null;
         colliders         = null;
     }
 }
Ejemplo n.º 3
0
 private void OnEnable()
 {
     if (waterBody == null)
     {
         waterBody = GetComponentInParent <WaterBody>();
     }
     if (NetGame.isClient)
     {
         cameraController  = Object.FindObjectOfType <CameraController3>();
         cameraWaterSensor = cameraController.gameObject.GetComponent <WaterSensor>();
         oldCameraPosition = cameraController.transform.position;
         colliders         = GetComponents <Collider>();
     }
 }
 public void SkipStartupExperience(object multiplayerServer)
 {
     cameraEffects    = Object.FindObjectOfType <MenuCameraEffects>();
     cameraController = Object.FindObjectOfType <CameraController3>();
     human            = Object.FindObjectOfType <Human>();
     ragdoll          = human.ragdoll;
     if (StartupExperienceUI.instance.gameObject != null)
     {
         StartupExperienceUI.instance.gameObject.SetActive(value: false);
     }
     Object.Destroy(StartupExperienceUI.instance.gameObject);
     LeaveGameStartupXP();
     DestroyStartupStuff();
     MenuSystem.instance.ShowMainMenu(hideLogo: true);
     if (multiplayerServer != null)
     {
         App.instance.AcceptInvite(multiplayerServer);
     }
 }
Ejemplo n.º 5
0
    private static GameCamera WrapCamera(Camera camera)
    {
        PostProcessLayer  postProcessLayer  = camera.GetComponent <PostProcessLayer>();
        CameraController3 componentInParent = camera.GetComponentInParent <CameraController3>();

        if (postProcessLayer == null)
        {
            postProcessLayer = new PostProcessLayer();
        }
        GameCamera gameCamera = new GameCamera();

        gameCamera.camera       = camera;
        gameCamera.blur         = camera.GetComponent <BlurOptimized>();
        gameCamera.holder       = camera.transform.parent;
        gameCamera.resetCounter = 3;
        gameCamera.layer        = postProcessLayer;
        GameCamera gameCamera2 = gameCamera;

        if (componentInParent != null)
        {
            postProcessLayer.volumeTrigger = componentInParent.human.transform;
            GameObject gameObject = new GameObject("Quick Volume (override focus)");
            gameObject.transform.SetParent(postProcessLayer.volumeTrigger, worldPositionStays: false);
            gameObject.layer = 30;
            SphereCollider sphereCollider = gameObject.AddComponent <SphereCollider>();
            sphereCollider.isTrigger = true;
            sphereCollider.radius    = 0.1f;
            PostProcessVolume postProcessVolume = gameObject.AddComponent <PostProcessVolume>();
            postProcessVolume.priority = 2f;
            PostProcessProfile postProcessProfile = postProcessVolume.sharedProfile = postProcessVolume.profile;
            gameCamera2.depthOfField = ScriptableObject.CreateInstance <DepthOfField>();
            gameCamera2.depthOfField.enabled.Override(instance.allowDepthOfField && !instance.blockBlur);
            postProcessProfile.AddSettings(gameCamera2.depthOfField);
        }
        else
        {
            postProcessLayer.volumeTrigger = camera.transform;
        }
        return(gameCamera2);
    }
Ejemplo n.º 6
0
 private static void ApplyCameraSettings()
 {
     CameraController3.SetFov((float)cameraFov / 20f);
     CameraController3.SetSmoothing((float)cameraSmoothing / 20f);
 }
    private IEnumerator StartupExperienceRoutine()
    {
        cameraEffects    = Object.FindObjectOfType <MenuCameraEffects>();
        cameraController = Object.FindObjectOfType <CameraController3>();
        human            = Human.all[0];
        ragdoll          = human.ragdoll;
        StartupExperienceUI startupUI = StartupExperienceUI.instance;

        MenuSystem.instance.EnterMenuInputMode();
        EnterGameStartupXP();
        Begin();
        drones.Play();
        while (drones.dronesTime < 1f)
        {
            yield return(null);
        }
        FadeOutDim();
        while (drones.dronesTime < offsetTime)
        {
            yield return(null);
        }
        startupUI.curveLogo.Play("CurveIn");
        while (drones.dronesTime < 4f + offsetTime)
        {
            yield return(null);
        }
        startupUI.curveLogo.Play("CurveOut");
        while ((double)drones.dronesTime < 6.01 + (double)offsetTime)
        {
            yield return(null);
        }
        startupUI.noBrakesLogo.Play("NbgLogoIn");
        while ((double)drones.dronesTime < 9.12 + (double)offsetTime)
        {
            yield return(null);
        }
        startupUI.noBrakesLogo.Play("NbgLogoOut");
        while ((double)drones.dronesTime < 10.5 + (double)offsetTime)
        {
            yield return(null);
        }
        startupUI.humanLogo.gameObject.SetActive(value: true);
        startupUI.humanLogo.Play("HumanLogoIn");
        startupUI.gameByLine1.Play("GameByInOut");
        startupUI.gameByLine2.Play("GameByInOut");
        yield return(new WaitForSeconds(1f));

        DropHuman();
        bool pressAnythingVisible = false;

        while ((double)drones.dronesTime < 13.2 + (double)offsetTime && !IsAnythingPressed())
        {
            yield return(null);
        }
        if (!IsAnythingPressed())
        {
            pressAnythingVisible = true;
            startupUI.pressAnything.Play("PressAnythingIn");
            while (!IsAnythingPressed())
            {
                yield return(null);
            }
        }
        ReleaseLatch();
        startupUI.humanLogo.Play("HumanLogoOut");
        if (pressAnythingVisible)
        {
            startupUI.pressAnything.Play("PressAnythingOut");
        }
    }