Exemplo n.º 1
0
 private void Awake()
 {
     if (instance != null)
     {
         Destroy(gameObject);
         Debug.LogError("Duplicate instances of '" + this.GetType().ToString() + "'. Bug?");
     }
     else
     {
         instance = this;
     }
 }
Exemplo n.º 2
0
    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>();
    }
Exemplo n.º 3
0
 private void OnEnable()
 {
     _camera     = GameObject.FindGameObjectWithTag("MainCamera").transform;
     cameraClamp = _camera.GetComponent <CameraClamp>();
     enemyMask   = LayerMask.GetMask("Enemy");
 }