You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
904 B
C#
31 lines
904 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class CameraManager : MonoBehaviour
|
|
{
|
|
public Transform MainCam;
|
|
public Transform StartingCamera;
|
|
Vector3 MainCamEulerAngles;
|
|
public Transform target; // Reference to the character
|
|
public float speed;
|
|
|
|
private void Start()
|
|
{
|
|
MainCamEulerAngles = MainCam.eulerAngles;
|
|
Invoke(nameof(StartingGameObjDisabler), 2.5f);
|
|
}
|
|
void StartingGameObjDisabler()
|
|
{
|
|
StartingCamera.gameObject.SetActive(false);
|
|
}
|
|
private void Update()
|
|
{
|
|
if (speed < 1)
|
|
speed += Time.deltaTime/10;
|
|
StartingCamera.position = Vector3.Lerp(StartingCamera.position, MainCam.position, speed);
|
|
StartingCamera.LookAt(target);
|
|
//StartingCamera.eulerAngles=Vector3.Lerp(StartingCamera.eulerAngles, MainCamEulerAngles, Time.deltaTime);
|
|
}
|
|
}
|