Beispiel #1
0
 public void WeaponPickup(WeaponKinds Kind)
 {
     if (Weapon.Kind != Kind)
     {
         // Set new weapon
         int Level = Math.Max(1, Weapon.Level - 1);
         Destroy(Weapon);
         (Weapon = WeaponBase.AttachWeapon(Kind, gameObject)).Level = Level;
         // Repaint GUI
         if (GUIColor)
         {
             Destroy(GUIColor);
         }
         if (GUITransparency)
         {
             Destroy(GUITransparency);
         }
         GUIColor = new Texture2D(1, 1);
         GUIColor.SetPixel(0, 0, Weapon.DisplayColor);
         GUIColor.Apply();
         GUITransparency = new Texture2D(1, 1);
         GUITransparency.SetPixel(0, 0, new Color(Weapon.DisplayColor.r, Weapon.DisplayColor.g, Weapon.DisplayColor.b, .5f));
         GUITransparency.Apply();
     }
     else
     {
         Weapon.AddLevel();
     }
     Score += 50;
 }