万年素人からHackerへの道

万年素人がHackerになれるまで殴り書きするぜ。

  • ・資産運用おすすめ
    10万円は1000円くらい利益
    資産運用ブログ アセマネ
    • ・寄付お願いします
      YENTEN:YYzNPzdsZWqr5THWAdMrKDj7GT8ietDc2W
      BitZenny:ZfpUbVya8MWQkjjGJMjA7P9pPkqaLnwPWH
      c0ban:8KG95GXdEquNpPW8xJAJf7nn5kbimQ5wj1
      Skycoin:KMqcn7x8REwwzMHPi9fV9fbNwdofYAWKRo

    Unity ライフバー

    http://unity3d.com/support/documentation/Components/gui-Layout.html
    前回紹介したやつだが実際実行すると表示がおかしい
    修正したい

    /* Using multiple Groups to clip the displayed Contents */
    
    var bgImage : Texture2D; // background image that is 256 x 32
    var fgImage : Texture2D; // foreground image that is 256 x 32
    var playerEnergy = 1.0; // a float between 0.0 and 1.0
    
    function OnGUI () {
    	// Create one Group to contain both images
    	// Adjust the first 2 coordinates to place it somewhere else on-screen
    	GUI.BeginGroup (Rect (0,0,256,32));
    
    	// Draw the background image
    	GUI.Box (Rect (0,0,256,32), bgImage);
    
    	// Create a second Group which will be clipped
    	// We want to clip the image and not scale it, which is why we need the second Group
    	GUI.BeginGroup (Rect (0,0,playerEnergy * 256, 32));
    
    	// Draw the foreground image
    	GUI.Box (Rect (0,0,256,32), fgImage);
    
    	// End both Groups
    	GUI.EndGroup ();
    	GUI.EndGroup ();
    }