当前位置: 首页>>代码示例>>C#>>正文


C# Camera.GetComponentInChildren方法代码示例

本文整理汇总了C#中Camera.GetComponentInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.GetComponentInChildren方法的具体用法?C# Camera.GetComponentInChildren怎么用?C# Camera.GetComponentInChildren使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Camera的用法示例。


在下文中一共展示了Camera.GetComponentInChildren方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

 public void Init()
 {
     if (!_init)
     {
         currentRoomX = 0;
         currentRoomY = 0;
         _nextRoomPos = Vector2.zero;
         _player = FindObjectOfType<Player>();
         _camera = FindObjectOfType<Camera>();
         _camera_behaviour = _camera.GetComponentInChildren<Camera_behaviour>();
         _boardManager = FindObjectOfType<GameController>().boardManager;
         _rooms = new Dictionary<Vector2, Room>();
         _init = true;
     }
 }
开发者ID:Aye1,项目名称:Jadrien-Quest,代码行数:15,代码来源:RoomManager.cs

示例2: Awake

    // Use this for initialization
    void Awake()
    {
        plr = GetComponentInChildren<Player>();
        plr.Setup(this);

        TUNING = Resources.Load("Scripts/Tuning") as DTTuning;

        Hours = gameObject.AddComponent<HoursManager>();
        Hours.Setup(this);

        remainingDay = TUNING.DaysComingBeforeSaveDay;

        pathDirector = GetComponentInChildren<WaypointDirector>();
        pathDirector.Setup(this);

        Dracu = GetComponentInChildren<Dracula>();
        Dracu.Setup(this);

        Diff = DifficultyState.BeforeLetter;

        PaperSpots = new List<GameObject>();
        GameObject pSpot = FETool.findWithinChildren(gameObject, "Spots/PaperSpot");
        Spot[] papSpot = pSpot.GetComponentsInChildren<Spot>();
        foreach (Spot obj in papSpot)
        {
            obj.spotType = Spot.spotList.Paper;
            PaperSpots.Add(obj.gameObject);
        }

        FoodSpots = new List<GameObject>();
        GameObject fSpot = FETool.findWithinChildren(gameObject, "Spots/FoodSpot");
        Spot[] fooSpot = fSpot.GetComponentsInChildren<Spot>();
        foreach (Spot obj in fooSpot)
        {
            obj.spotType = Spot.spotList.Food;
            FoodSpots.Add(obj.gameObject);
        }

        //		respawnPaper(PaperSpots);
        spawnFood(FoodSpots);
        saveDay = 1000;

        MailmanState = MailManStateList.Away;
        currCam = FETool.findWithinChildren(gameObject, "Camera").GetComponent<Camera>();
        GameUI = currCam.GetComponentInChildren<UI>();
        GameUI.Setup(this);

        GetComponentInChildren<MailManPlace>().Setup(this);
        bedList = GetComponentsInChildren<Bed>();

        Door[] Doors = GetComponentsInChildren<Door>();
        foreach (Door _dr in Doors)
        {
            _dr.Setup(this);
        }

        Waypoint[] Waypo = GetComponentsInChildren<Waypoint>();
        foreach (Waypoint _wp in Waypo)
        {
            wpList.Add(_wp);
        }

        GameEventManager.GameOver += GameOver;
        GameEventManager.Respawn += Respawn;
        GameEventManager.GameStart += GameStart;
        GameEventManager.EndGame += EndGame;

        MasterAudio.PlaySound("ambiance");

        //				GAMESTATE = GameEventManager.GameState.MainMenu;
        //				GameEventManager.TriggerRespawn("Rsp");
        GAMESTATE = GameEventManager.GameState.Live;
        GameEventManager.TriggerGameStart("First Init");
    }
开发者ID:Tavrox,项目名称:PuzzleRunner,代码行数:75,代码来源:LevelManager.cs

示例3: WebCamImpl

    public WebCamImpl(Camera arCamera, Camera backgroundCamera, int renderTextureLayer, string webcamDeviceName, bool flipHorizontally)
    {
        #if UNITY_EDITOR
        mRenderTextureLayer = renderTextureLayer;

        // get main camera, set correct clear flags:
        mARCamera = arCamera;
        mOriginalCameraClearFlags = mARCamera.clearFlags;
        mARCamera.clearFlags = CameraClearFlags.Depth;

        // instanciate BackgroundCamera
        mBackgroundCameraInstance = backgroundCamera;

        // make sure the correct prefab has been attached:
        mBgRenderingTexBehaviour =
            mBackgroundCameraInstance.GetComponentInChildren<BGRenderingBehaviour>();
        if (mBgRenderingTexBehaviour == null)
        {
            Debug.LogError("Instanciated Prefab does not contain VideoTextureBehaviour!");
        }
        else
        {
            mOriginalCameraCullMask = mARCamera.cullingMask;
            // set mask to cull away bg rendering behaviour and texture buffer layer
            mARCamera.cullingMask &= ~(1 << mBgRenderingTexBehaviour.gameObject.layer);
            mARCamera.cullingMask &= ~(1 << mRenderTextureLayer);

            // load the webcam profiles
            WebCamProfile profiles = new WebCamProfile();

            if (QCARRuntimeUtilities.IsQCAREnabled() && (WebCamTexture.devices.Length > 0))
            {
                // check if selected web cam shows up in list of available devices:
                bool selectedWebCamAvailable = false;
                foreach (WebCamDevice webCamDevice in WebCamTexture.devices)
                    if (webCamDevice.name.Equals(webcamDeviceName))
                        selectedWebCamAvailable = true;

                // if it was not found, default to first available camera
                if (!selectedWebCamAvailable) webcamDeviceName = WebCamTexture.devices[0].name;

                mWebCamProfile = profiles.GetProfile(webcamDeviceName);

                // create webcam texture adaptor
                mWebCamTexture = new WebCamTexAdaptorImpl(webcamDeviceName, mWebCamProfile.RequestedFPS,
                                                            mWebCamProfile.RequestedTextureSize);
            }
            else
            {
                // no webcam connected, use default profile and null implementation for webcam
                mWebCamProfile = profiles.Default;

                // create null webcam implementation
                mWebCamTexture = new NullWebCamTexAdaptor(mWebCamProfile.RequestedFPS, mWebCamProfile.RequestedTextureSize);
            }

            // override the texture created by the the VideoTextureBehaviour
            mBgRenderingTexBehaviour.SetFlipHorizontally(flipHorizontally);

            mFlipHorizontally = flipHorizontally;
        }
        #endif
    }
开发者ID:JSungMin,项目名称:AugmentedRealityExample,代码行数:63,代码来源:WebCamImpl.cs


注:本文中的Camera.GetComponentInChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。