血槽制作

     var showGUI = false;
  var foregroundTexture:Texture;//血值
  var foreground01Texture:Texture;//法力值
  var EnmetryforegroundTexture:Texture;//敌人血值
  var backgroundTexture:Texture ;
  var rightSide = false;
 
 function OnGUI ()
 {
      if(showGUI == true)
   {
        var health =GetComponent("BloomAndPower").bloom/100.0;
     var power =GetComponent("BloomAndPower").power/100.0;
    
    var rect :Rect = new Rect(10, Screen.height/10+15, Screen.width/4, backgroundTexture.height);
    var rect01 :Rect = new Rect(10, Screen.height/10+35, Screen.width/4, backgroundTexture.height);
   if (rightSide)
   {
    rect.x = Screen.width*0.6 - rect.x;
    rect.width = -rect.width;
    GUI.DrawTexture(rect, backgroundTexture);
       rect.width *= health;
       GUI.DrawTexture(rect, EnmetryforegroundTexture );
   }
   else
   {
    GUI.DrawTexture(rect, backgroundTexture);
    rect.width *= health;
    GUI.DrawTexture(rect, foregroundTexture);
    
    GUI.DrawTexture(rect01, backgroundTexture);
    rect01.width *= power;
    GUI.DrawTexture(rect01, foreground01Texture);
    //GUI.color = Color.yellow;
   }
  }
 }

posted @ 2012-07-07 07:49  softimagewht  阅读(338)  评论(0编辑  收藏  举报