void Start() { gm = GameManager.instance; rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); cam = FindObjectOfType <CinemachineVirtualCamera>(); composer = cam.GetCinemachineComponent <CinemachineFramingTransposer>(); if (gm.resetCount == 0) { GameManager.instance.lastCheckpos = transform.position; } else if (gm.resetCount > 0) //ya no sirve, pero dejemoslo por las dudas { transform.position = GameManager.instance.lastCheckpos; } PhysicsMaterial2D physicMaterial = new PhysicsMaterial2D(gameObject.name); physicMaterial.bounciness = 0; physicMaterial.friction = 0; rb.sharedMaterial = physicMaterial; }
private void Awake() { cineGroup = FindObjectOfType <CinemachineTargetGroup>(); vcam = FindObjectOfType <CinemachineVirtualCamera>(); cineFramTrans = vcam.GetCinemachineComponent <CinemachineFramingTransposer>(); //cineFramTrans.m_GroupFramingSize -= 0.1f; }
// Update is called once per frame void Update() { CinemachineVirtualCamera vCamera = this.brain?.ActiveVirtualCamera?.VirtualCameraGameObject?.GetComponent <CinemachineVirtualCamera>(); if (vCamera == null) { return; } CinemachineFramingTransposer vTransposer = vCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); float vAxis = Input.GetAxis("Vertical") * -1.0f; if (vAxis != 0.0f) { vTransposer.m_CameraDistance = vTransposer.m_CameraDistance + (zoomSpeed * Time.deltaTime * vAxis); } float hAxis = Input.GetAxis("Horizontal"); if (hAxis != 0.0f) { Vector3 euler = vCamera.transform.eulerAngles; vCamera.transform.eulerAngles = new Vector3(euler.x, euler.y + (rotationSpeed * Time.deltaTime * hAxis), euler.z); //Debug.Log(new Vector3(euler.x, euler.y + (rotationSpeed * Time.deltaTime * hAxis), euler.z)); } }
public void setTarget(Transform target) { this.GetComponentsInChildren <CinemachineVirtualCamera>()[0].Follow = target; CinemachineFramingTransposer framingBody = this.GetComponentsInChildren <CinemachineVirtualCamera>()[0].GetCinemachineComponent <CinemachineFramingTransposer>(); framingBody.m_DeadZoneHeight = 1; }
// Start is called before the first frame update void Start() { cm = GetComponent <CinemachineVirtualCamera>(); cm.GetComponentPipeline(); transposer = cm.GetCinemachineComponent <CinemachineFramingTransposer>(); player = GameObject.FindGameObjectWithTag("Player"); }
private void Awake() { _camera = FindObjectOfType <CinemachineVirtualCamera>() .GetCinemachineComponent <CinemachineFramingTransposer>(); Timer.Instance.Begin(); LoadLevel(); }
public override void SetCamera(CinemachineFramingTransposer body) { body.m_LookaheadIgnoreY = true; body.m_ScreenY = 0.6f; body.m_DeadZoneHeight = 0.1f; body.m_BiasY = -0.1f; }
// Start is called before the first frame update void Start() { state = PlayerCharacter.VelocityState.idle; Camera = GameObject.Find("2DCamera(Clone)"); VirtualCamera = Camera.GetComponent <CinemachineVirtualCamera>(); fComposer = VirtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); }
private void Start() { cam = GetComponent <CinemachineVirtualCamera>(); camTransposer = cam.GetCinemachineComponent <CinemachineFramingTransposer>(); camNoise = cam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>(); cameraController = normalCam.GetComponent <CameraController>(); }
void Start() { cam = GetComponent <CinemachineVirtualCamera>(); virtualCameraNoise = cam.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>(); framingTransposer = cam.GetCinemachineComponent <CinemachineFramingTransposer>(); _ = StartCoroutine(FindPlayer()); }
// Use this for initialization void Start() { if (!m_vCam) { m_vCam = GetComponent <CinemachineVirtualCamera>(); } Transform follow = m_vCam.Follow; m_handledGroup = follow.GetComponent <CinemachineTargetGroup>(); if (!m_handledGroup) { Debug.LogError("This camera does not use TargetGroup, this script has no use and will disabled itself ..."); enabled = false; return; } m_targets = m_handledGroup.m_Targets; m_framingTransposer = m_vCam.GetCinemachineComponent <CinemachineFramingTransposer>(); if (!m_framingTransposer) { Debug.LogError("This Camera has no Body \"FramingTransposer\", this script has no use and will disable itself ..."); enabled = false; return; } //float halfScreenSize = m_vCam.m_Lens.OrthographicSize * m_vCam.m_Lens.Aspect; //m_borderOffset = m_framingTransposer.m_DeadZoneWidth * halfScreenSize; }
private void Start() { transposer = GetComponent <CinemachineVirtualCamera>().GetCinemachineComponent <CinemachineFramingTransposer>(); prevState = IsFacingRight(); UpdateTargetValue(); }
void Start() { cinemachineVirtualCamera.Follow = playerCharacterController.transform; framingTransposer = cinemachineVirtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); framingTransposer.m_SoftZoneHeight = 0.5195311f; framingTransposer.m_SoftZoneWidth = 0.5472223f; }
protected override void Awake() { base.Awake(); _transposer = GetCinemachineComponent <CinemachineFramingTransposer>(); Assert.IsNotNull(_transposer); }
public void ActivateCamera() { if (allCameras != null) { foreach (CameraBehaviour b in allCameras) { if (b != this) { b.DesactivateCamera(); } } } activated = true; CinemachineFramingTransposer transposer = virtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); if (transposer != null) { transposer.m_MinimumDistance = minCameraDistance; transposer.m_MaximumDistance = maxCameraDistance; } if (!staticCamera) { virtualCamera.m_Follow = followPoint.transform; } virtualCamera.m_LookAt = followPoint.transform; }
void Awake() { //Assigning objects or components cinemachine = Camera.main.GetComponentInChildren <CinemachineVirtualCamera>().GetCinemachineComponent <CinemachineFramingTransposer>(); animator = this.gameObject.GetComponent <Animator>(); rb = this.gameObject.GetComponent <Rigidbody>(); isDiving = false; staminaController = false; GameObject.Find("Global Volume").GetComponent <Volume>().profile.TryGet(out vignette); particleSystem = GameObject.Find("Particle System").GetComponent <ParticleSystem>(); //Assigning actions GameManager.Instance.startGame += () => { this.enabled = true; }; GameManager.Instance.gameOver += () => { particleSystem.Play(); this.gameObject.GetComponent <AudioSource>().Play(); rb.velocity = Vector3.zero; this.gameObject.GetComponent <SkinnedMeshRenderer>().enabled = false; this.enabled = false; }; }
public override void SetCamera(CinemachineFramingTransposer body) { body.m_LookaheadIgnoreY = false; body.m_ScreenY = 0.5f; body.m_DeadZoneHeight = 0.2f; body.m_BiasY = 0; }
private void Awake() { cinemachine = GetComponent <CinemachineVirtualCamera>(); cinemachinePerlin = cinemachine.GetCinemachineComponent <CinemachineBasicMultiChannelPerlin>(); cinemachineFraming = cinemachine.GetCinemachineComponent <CinemachineFramingTransposer>(); cinemachineFrameInitialScreenY = cinemachineFraming.m_ScreenY; }
protected override void Awake() { base.Awake(); _transposer = GetCinemachineComponent <CinemachineFramingTransposer>(); _confiner = GetComponent <CinemachineConfiner>(); }
private void ApplyOffsets() { float offsetX; float offsetY; if (_positionSide == Vector2.right || _positionSide == Vector2.down) { offsetX = leftOrTopOffsetX; offsetY = leftOrTopOffsetY; } else { offsetX = rightOrBottomOffsetX; offsetY = rightOrBottomOffsetY; } CinemachineFramingTransposer transposer = _virtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); float sum = transposer.m_ScreenX + offsetX; if (sum > 0 && sum < 1) { transposer.m_ScreenX += offsetX; } sum = transposer.m_ScreenY + offsetY; if (sum > 0 && sum < 1) { transposer.m_ScreenY += offsetY; } }
/// <summary> /// Add a virtual camera for viewing this object if there isn't one /// already assigned to `virtualCamera`. If one is assigned prepare it /// for the scene. Called during startup. /// </summary> private void ConfigureVirtualCamera() { if (_virtualCamera != null) { return; } Bounds bounds = this.GetComponent <Collider>().bounds; // TODO: Make a prefab and instantiate from that rather than creating at runtime GameObject camera = new GameObject(); camera.name = "Virtual Camera for " + this.name; _virtualCamera = camera.AddComponent <CinemachineVirtualCamera>(); _virtualCamera.m_StandbyUpdate = CinemachineVirtualCameraBase.StandbyUpdateMode.Never; _virtualCamera.LookAt = transform; _virtualCamera.Follow = transform; CinemachineFramingTransposer transposer = ((CinemachineVirtualCamera)_virtualCamera).AddCinemachineComponent <CinemachineFramingTransposer>(); transposer.m_CameraDistance = bounds.extents.x * 2; ((CinemachineVirtualCamera)_virtualCamera).AddCinemachineComponent <CinemachineComposer>(); camera.transform.parent = gameObject.transform; }
void Start() { cine = ((CinemachineFramingTransposer)cinemachine.GetComponentPipeline()[0]); activitiesManager = LoadInfo.Instance.activitiesManager; isExecute = true; Cursor.SetCursor(cursorTexture, Vector2.one * 8, CursorMode.Auto); }
/// <summary> /// On Awake we grab our components /// </summary> protected virtual void Awake() { _virtualCamera = GetComponent <CinemachineVirtualCamera>(); _confiner = GetComponent <CinemachineConfiner>(); _currentZoom = _virtualCamera.m_Lens.Orthographic ? InitialOrthographicZoom : InitialPerspectiveZoom; _framingTransposer = _virtualCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); }
void Start() { cinemachineFraming = vcam.GetCinemachineComponent <CinemachineFramingTransposer>(); originalY = cinemachineFraming.m_ScreenY; currentIdleTimer = Time.time; relativePosYLookDown = cinemachineFraming.m_ScreenY - offsetY; relativePosYLookUp = cinemachineFraming.m_ScreenY + offsetY; }
// Start is called before the first frame update void Start() { Player = GameObject.FindGameObjectWithTag("PlayerFollower").transform; CameraController = gameObject.GetComponent <CinemachineVirtualCamera>(); FramingTransposer = CameraController.GetCinemachineComponent <CinemachineFramingTransposer>(); NormalZoom = CameraController.m_Lens.OrthographicSize; CameraController.Follow = Player; }
void Update() { if (player != null) { CinemachineFramingTransposer comp = GetComponent <CinemachineVirtualCamera>().GetCinemachineComponent <CinemachineFramingTransposer>(); comp.m_TrackedObjectOffset = player.position - beacon.position; } }
// Initialize private void Awake() { Instance = this; Camera = GetComponent <CinemachineVirtualCamera>(); _framingTransposer = Camera.GetCinemachineComponent <CinemachineFramingTransposer>(); Zoom(0); // Init the zoom as well }
public void ScreenShiftX(float _shiftAmount = 0f) { CinemachineFramingTransposer transposer = ((CinemachineVirtualCamera)camera2D).GetCinemachineComponent <CinemachineFramingTransposer>(); float shiftAmount = Mathf.Clamp01(defaultScreenX + _shiftAmount); transposer.m_ScreenX = shiftAmount; }
private void Start() { defaultFixedDeltaTime = Time.fixedDeltaTime; gameCameraTransposer = gameCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); defaultCameraTrackedObjectOffset = gameCameraTransposer.m_TrackedObjectOffset; defaultCameraOrthographicSize = gameCamera.m_Lens.OrthographicSize; }
// Update is called once per frame void LateUpdate() { //Moon and sun movement /* * //calculate moon or sun position * _unitsPassed += PlayerCharacter.transform.position.x - _lastPlayerCharacterXPosition; * _lastPlayerCharacterXPosition = PlayerCharacter.transform.position.x; * //AddScore(Mathf.FloorToInt(_unitsPassed / 4)); * _unitsPassed %= 4; * * float routeLength = EndPoint.transform.position.x - StartPoint.transform.position.x; * float routeDoneInPercents = (PlayerCharacter.transform.position.x - StartPoint.transform.position.x) / routeLength * 100; * //TextMeshRoute.SetText($"{routeDoneInPercents} %"); * * //Note: find better solution * float cameraWidth = MainCamera.ViewportToWorldPoint(new Vector3(1f, 1f, MainCamera.transform.position.z)).x * - MainCamera.ViewportToWorldPoint(new Vector3(0f, 1f, MainCamera.transform.position.z)).x; * //Debug.Log($"CameraWidth = {cameraWidth}"); * Moon.Offset = new Vector2( cameraWidth * routeDoneInPercents / 100, 0); */ if (_isNeedToRefreshCamera) { _currentRefreshTime += Time.deltaTime; bool isEnded = false; if (_currentRefreshTime >= _targetRefreshCameraTime) { _currentRefreshTime = _targetRefreshCameraTime; isEnded = true; } float refreshValue = _currentRefreshTime / _targetRefreshCameraTime; CinemachineFramingTransposer framTransposer = VirtCamera.GetCinemachineComponent <CinemachineFramingTransposer>(); framTransposer.m_ScreenX = Mathf.Lerp(_currentScreenXPos, _targetScreenXPos, refreshValue); framTransposer.m_LookaheadTime = Mathf.Lerp(_currentLookaheadTime, _targetLookaheadTime, refreshValue); if (isEnded) { framTransposer.m_ScreenY = _targetScreenY; _currentScreenY = _targetScreenY; _currentCameraStatus = _targetCameraStatus; _currentLookaheadTime = _targetLookaheadTime; _currentRefreshCameraTime = _targetRefreshCameraTime; _currentScreenXPos = _targetScreenXPos; _currentRefreshTime = 0f; _isNeedToRefreshCamera = false; if (_secondChanceRequested) { ActivateSecondChance(); } } } }