Advertisement
Guest User

EnergyBarScript

a guest
Aug 12th, 2014
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.43 KB | None | 0 0
  1.  
  2. public class EnergyBarScript : MonoBehaviour {
  3.  
  4.     public void UpdateEnergyBar (  Transform energySprite, float currentEnergy, Vector3 energyScale)
  5.     {  
  6. //      if (energySprite == null)
  7. //                      return;
  8.  
  9.         Debug.Log ("EnergySprite" + energySprite.name);
  10.         energySprite.transform.localScale = new Vector2 (energyScale.x + currentEnergy , 1);
  11.         Debug.Log ("energySprite scale on x axes   " + energySprite.transform.localScale.x);
  12.  
  13.     }
  14.    
  15.     public void ColorMatchFunction(string color, float DamageAmount)
  16.     {
  17.         ColorMatch colorMathc = ColorFactory.CreateColorFromName (color);
  18.         colorMathc.DoColor (DamageAmount);
  19.         string colorName = colorMathc.GetColorName ();
  20.         Debug.Log ("Color that had an Match3 " + colorName);
  21.  
  22.     }  
  23.  
  24. }
  25. public interface ColorMatch
  26. {
  27.     void DoColor(float DamageAmount);
  28.     string GetColorName();
  29.  
  30. }
  31.  
  32.  
  33. public class BlueMaterial : ColorMatch
  34. {
  35.     MenuScript menuScriptObj = GameObject.Find("Menu").GetComponent<MenuScript>();
  36.     EnergyBarScript energyBar = GameObject.Find("Items").GetComponent<EnergyBarScript>();
  37.  
  38.     public void DoColor(float DamageAmount)
  39.     {
  40.         Debug.Log ("This is _blue " + menuScriptObj._blue);
  41.         menuScriptObj.blueEnergy += DamageAmount;
  42.         menuScriptObj.blueEnergy = Mathf.Clamp (menuScriptObj.blueEnergy, 1, 101);
  43.         energyBar.UpdateEnergyBar (  menuScriptObj.blue, menuScriptObj.blueEnergy, menuScriptObj.blueScale);
  44.     }
  45.    
  46.     public string GetColorName()
  47.     {
  48.         return "This is BlueMaterial";
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement