本文整理汇总了C#中GUITexture类的典型用法代码示例。如果您正苦于以下问题:C# GUITexture类的具体用法?C# GUITexture怎么用?C# GUITexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GUITexture类属于命名空间,在下文中一共展示了GUITexture类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Start
// Use this for initialization
void Start()
{
_display = gameObject.GetComponent<GUITexture>();
_maxBarLength = (int)_display.pixelInset.width;
OnEnable();
}
示例2: ControlButton
public ControlButton(GUITexture _gui, Texture _textureOn, Texture _textureOff)
{
// isPlayer = Application.platform == RuntimePlatform.OSXPlayer;
gui = _gui;
textureOn = _textureOn;
textureOff = _textureOff;
}
示例3: Start
// Use this for initialization
void Start()
{
_vitalBar = gameObject.GetComponent<GUITexture>();
_maxBarLength = _vitalBar.pixelInset.width; //set the bar length to the texture width
OnEnable();
}
示例4: Awake
void Awake()
{
_GUITexture = GetComponent<GUITexture>();
float width = _GUITexture.pixelInset.width * Screen.width / 752;
float height = _GUITexture.pixelInset.height * Screen.height / 423;
_GUITexture.pixelInset = new Rect(-width * 0.5F, -height * 0.5F, width, height);
}
示例5: Awake
void Awake ()
{
_transform = transform;
_gui = GetComponent<GUITexture> ();
_gui.enabled = false;
_defaultRect = _gui.pixelInset;
_defaultRect.x += _transform.position.x * Screen.width;// + gui.pixelInset.x; // - Screen.width * 0.5;
_defaultRect.y += _transform.position.y * Screen.height;// - Screen.height * 0.5;
_transform.position = Vector3.zero;
if (touchPad) {
// If a texture has been assigned, then use the rect ferom the gui as our touchZone
if (_gui.texture)
touchZone = _defaultRect;
} else {
_guiTouchOffset.x = _defaultRect.width * 0.5f;
_guiTouchOffset.y = _defaultRect.height * 0.5f;
// Cache the center of the GUI, since it doesn't change
_guiCenter.x = _defaultRect.x + _guiTouchOffset.x;
_guiCenter.y = _defaultRect.y + _guiTouchOffset.y;
// Let's build the GUI boundary, so we can clamp joystick movement
_guiBoundary.min.x = _defaultRect.x - _guiTouchOffset.x / xBounds;
_guiBoundary.max.x = _defaultRect.x + _guiTouchOffset.x / xBounds;
_guiBoundary.min.y = _defaultRect.y - _guiTouchOffset.y / yBounds;
_guiBoundary.max.y = _defaultRect.y + _guiTouchOffset.y / yBounds;
}
ResetJoystick ();
}
示例6: Awake
//
private void Awake()
{
if (divvyFactor == 0) {
divvyFactor = 1;
}
button = gameObject.AddComponent ("GUITexture") as GUITexture;
button.texture = button2D;
button.color = inactiveColor;
transform.position = new Vector3 (0f, 0f, transform.position.z);
//Debug.Log ("sw = " + Screen.width + " sh = " + Screen.height);
button.pixelInset = new Rect (GetPixelScale (transform.position.x, Screen.width), GetPixelScale (transform.position.y, Screen.height), (Screen.width / divvyFactor), (Screen.width / divvyFactor));
//Debug.Log ("1) " + button.pixelInset);
if (button.pixelInset.x < (Screen.width / 3) + 25 && button.pixelInset.y < (Screen.height / 3) + 25) {
button.pixelInset = new Rect ((Screen.width / 3) + 410, -117, (Screen.width / divvyFactor), (Screen.width / divvyFactor));
//Debug.Log ("2) " + button.pixelInset);
}
if (button.pixelInset.x > Screen.width - (button.pixelInset.width + 25) && button.pixelInset.y > Screen.height - (button.pixelInset.height + 25)) {
button.pixelInset = new Rect (Screen.width - (button.pixelInset.width + 25), Screen.height - (button.pixelInset.height + 25), (Screen.width / divvyFactor), (Screen.width / divvyFactor));
//Debug.Log ("3) " + button.pixelInset);
}
fingerID = -1;
lastID = -1;
tapTimer = 0;
enable = true;
VBRsingleTap = false;
VBRdoubleTap = false;
objPlayer = (GameObject)GameObject.FindWithTag ("Player");
}
示例7: Start
// Use this for initialization
void Start ()
{
m_StartTime = Time.timeSinceLevelLoad ;
m_EndTime = m_StartTime + m_ElapsedSec ;
m_TargetGUITexture = this.guiTexture ;
m_OrgRect = new Rect( m_TargetGUITexture.pixelInset ) ;
}
示例8: Field
public Field(string fieldName, int player)
{
CustomError ce = new CustomError("Field", "constructor");
this.cells = new Cell[this.byX, this.byY];
for (int i = 0; i < this.byX; i++)
{
for (int j = 0; j < this.byY; j++)
{
this.cells[i, j] = new Cell(i, j);
}
}
Morpher mphr = GameObject.Find("Morpher").GetComponent<Morpher>();
mphr.InstAField(fieldName, ref this.realObjectReference);
if (player == 1)
{
this.crossHair = mphr.InstACross().GetComponent<GUITexture>();
this.allocatingShips = true;
}
else
{
this.allocatingShips = false;
}
EventManager.OnResize += this.ResizeAfterCreate;
}
示例9: FadeToWhite
void FadeToWhite()
{
if (startFade)
{
if (whiteBackground == null)
{
whiteBackground = (GUITexture)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().whiteBackground);
whiteBackground.name = "WhiteBackground";
whiteBackground.gameObject.AddComponent("ResizeGUITexture");
(whiteBackground.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = whiteBackground.guiTexture;
(whiteBackground.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();
SceneManager.Instance.scene.DestroySomeInterfaceElements();
}
if (whiteBackground.color.a < 0.5f)
whiteBackground.color = new Color(
whiteBackground.color.r,
whiteBackground.color.g,
whiteBackground.color.b,
whiteBackground.color.a + fadeConst * Time.deltaTime);
else
{
Destroy(whiteBackground);
whiteBackground = null;
SceneManager.Instance.scene.CloseScene();
SceneManager.Instance.ChangeLevelCampaignMode(level);
}
}
}
示例10: Start
// Use this for initialization
void Start ()
{
m_StartTime = Time.timeSinceLevelLoad ;
m_EndTime = m_StartTime + m_ElapsedSec ;
m_TargetGUITexture = this.guiTexture ;
m_OrgColor = m_TargetGUITexture.color ;
}
示例11: Start
// Use this for initialization
void Start()
{
healthObject = GameObject.Find("GUI/g_health");
healthTexture = healthObject.GetComponent<GUITexture>();
healthValue = 100;
}
示例12: Awake
void Awake()
{
#if !(UNITY_EDITOR)
_gui_text = GetComponent<GUIText> ();
_gui_texture = GetComponent<GUITexture> ();
screenX = Screen.width;
screenY = Screen.height;
scaleX = screenX / 960;
scaleY = screenY / 640;
if (_gui_texture != null) {
_guiWidth = _gui_texture.pixelInset.width;
_guiHeight = _gui_texture.pixelInset.height;
_guiWidth *= scaleX;
_guiHeight *= scaleY;
}
if(_gui_text != null)
{
_gui_text.fontSize = (int)(edit_fontSize * (scaleX));
}
PositionSetting ();
#endif
}
示例13: Start
// Use this for initialization
protected void Start()
{
texture = GetComponent<GUITexture>();
texture.enabled = true;
text = GetComponentInChildren<GUIText>();
text.enabled = true;
}
示例14: Awake
void Awake()
{
player = GameObject.FindWithTag("Flashlight");
fader = (GameObject.Find("ScreenFader").GetComponent<GUITexture>()as GUITexture);
fader.guiTexture.enabled = false;
fader.guiTexture.pixelInset = new Rect(-5000, -5000, 10000, 10000);
}
示例15: Start
public override void Start()
{
//-PLAYERAIRPLANE-------------------------------------------------------------------------//
playerAirplane = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().PlayerAirplane);
playerAirplane.name = "PlayerAirplane";
// Setamos a o aviao como alvo da camera
SmoothFollow.Instance.target = playerAirplane.transform;
//-SET------------------------------------------------------------------------------------//
Set = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Set);
Set.name = "Set";
//-LIGHT----------------------------------------------------------------------------------//
Light = (GameObject)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().Light);
Light.name = "Light";
//-INTERFACE-IN-GAME----------------------------------------------------------------------//
interfaceInGame = (GUITexture)Instantiate(AssetManager.Instance.GetCampaignAndSurviveModeAssets().interfaceInGame);
interfaceInGame.name = "InterfaceInGame";
interfaceInGame.gameObject.AddComponent("ResizeGUITexture");
(interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).image = interfaceInGame.guiTexture;
(interfaceInGame.GetComponent("ResizeGUITexture") as ResizeGUITexture).StartResize();
(interfaceInGame.GetComponent("AirSpeedIndicator") as AirSpeedIndicator).playerAirplane = (this.playerAirplane.GetComponent("PlayerAirplane") as PlayerAirplane);
}