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


C# GUITexture类代码示例

本文整理汇总了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();
    }
开发者ID:riscvul,项目名称:LD28,代码行数:8,代码来源:VitalBar.cs

示例2: ControlButton

 public ControlButton(GUITexture _gui, Texture _textureOn, Texture _textureOff)
 {
     // isPlayer = Application.platform == RuntimePlatform.OSXPlayer;
     gui = _gui;
     textureOn = _textureOn;
     textureOff = _textureOff;
 }
开发者ID:IlyaBokovenko,项目名称:spear-fishing,代码行数:7,代码来源:ControlButton.cs

示例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();
    }
开发者ID:Dover8,项目名称:game-off-2012,代码行数:8,代码来源:VitalBar.cs

示例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);
 }
开发者ID:Rirols,项目名称:Nebessa,代码行数:7,代码来源:TextureSize.cs

示例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 ();
	}
开发者ID:calvinwo,项目名称:missile,代码行数:29,代码来源:Joystick.cs

示例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");
 }
开发者ID:reidbuz,项目名称:Droid-Wars,代码行数:29,代码来源:VirtualButtonRegion.cs

示例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 ) ;
	}
开发者ID:NDark,项目名称:Ntust2013Unity_GitHub,代码行数:8,代码来源:GUITextureShake01.cs

示例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;
    }
开发者ID:Sckorn,项目名称:battleships,代码行数:27,代码来源:Field.cs

示例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);
            }
        }
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:30,代码来源:FadeBackground.cs

示例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 ;
	}
开发者ID:NDark,项目名称:Ntust2013Unity_GitHub,代码行数:8,代码来源:GUITextureColor01.cs

示例11: Start

    // Use this for initialization
    void Start()
    {
        healthObject = GameObject.Find("GUI/g_health");
        healthTexture = healthObject.GetComponent<GUITexture>();

        healthValue = 100;
    }
开发者ID:sindanar,项目名称:RunSamurai,代码行数:8,代码来源:GUIController.cs

示例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
    }
开发者ID:CodeZob,项目名称:BoxRunner,代码行数:27,代码来源:Gui_Layout.cs

示例13: Start

 // Use this for initialization
 protected void Start()
 {
     texture = GetComponent<GUITexture>();
     texture.enabled = true;
     text = GetComponentInChildren<GUIText>();
     text.enabled = true;
 }
开发者ID:upsidedownquestionmark,项目名称:prototype,代码行数:8,代码来源:GUIElement.cs

示例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);
 }
开发者ID:shafeen,项目名称:EECS494-FinalGame,代码行数:7,代码来源:WinScript.cs

示例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);
    }
开发者ID:vitormartins1,项目名称:vermillion-war,代码行数:27,代码来源:SurviveMode.cs


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