您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
36 行
765 B
36 行
765 B
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.Rendering.PostProcessing;
|
|
|
|
[RequireComponent(typeof(Camera))]
|
|
public class GameCamera : MonoBehaviour
|
|
{
|
|
Camera m_Camera;
|
|
|
|
private void Awake()
|
|
{
|
|
m_Camera = GetComponent<Camera>();
|
|
}
|
|
|
|
private bool pushed = false;
|
|
private void Update()
|
|
{
|
|
if (Game.game == null)
|
|
return;
|
|
|
|
if (!pushed)
|
|
{
|
|
pushed = true;
|
|
Game.game.PushCamera(m_Camera);
|
|
}
|
|
}
|
|
|
|
private void OnDisable()
|
|
{
|
|
if (Game.game)
|
|
Game.game.PopCamera(m_Camera);
|
|
else
|
|
GameDebug.LogWarning("Unable to pop GameCamera " + gameObject.name + ". No Game.game");
|
|
}
|
|
}
|