예제 #1
0
파일: World.cs 프로젝트: VirtuaIRiot/Game
    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);
        }
    }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        Follow followScript = Camera.main.GetComponent <Follow>();

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