Exemplo n.º 1
0
    public void AddcameraFllow()
    {
        if (gameObject == null || player != null)
        {
            Camera mainCamera = Camera.main;

            Debug.Log("<---------mainCamera------------>:" + mainCamera);

            if (mainCamera == null)
            {
                Debug.LogError("mainCamera not found:" + mainCamera);
            }

            Follow cameraFllow = mainCamera.GetComponent <Follow>();
            if (cameraFllow == null)
            {
                Debug.LogError("cameraFllow not found:" + cameraFllow);
            }

            ShipBase myship = player.GetComponent <ShipBase>();
            if (myship == null)
            {
                Debug.LogError("myship not found:" + myship);
            }

            cameraFllow.AttachTarget(player.transform, myship.camerOffset);
        }
    }
Exemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        Follow followScript = Camera.main.GetComponent <Follow>();

        followScript.AttachTarget(transform, Vector3.zero);
    }