本文整理汇总了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;
}
}
示例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");
}
示例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
}