private void Awake() { if (instance != null) { Destroy(gameObject); Debug.LogError("Duplicate instances of '" + this.GetType().ToString() + "'. Bug?"); } else { instance = this; } }
private void Start() { // Get the players transforms from the GameManager playerTop = GameManager.instance.playerTop; playerBot = GameManager.instance.playerBot; startFollowSpeed = followSpeed; State = CameraState.FollowingBoth; currentZoomTime = zoomTime; cam = GetComponent <Camera>(); // Place camera on the players transform.position = new Vector3(playerTop.position.x + (playerBot.position.x - playerTop.position.x) / 2, 0f, -10f); clamp = GetComponent <CameraClamp>(); }
private void OnEnable() { _camera = GameObject.FindGameObjectWithTag("MainCamera").transform; cameraClamp = _camera.GetComponent <CameraClamp>(); enemyMask = LayerMask.GetMask("Enemy"); }