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;
 }
Exemple #2
0
        public WeaponClass(int x, int y) : base(MapContent.WeaponSpace, x, y)
        {
            combatPoints = Utils.rnd.Next(5, 51);

            Array values = Enum.GetValues(typeof(WeaponKinds));

            kind        = (WeaponKinds)values.GetValue(Utils.rnd.Next(values.Length));
            values      = Enum.GetValues(typeof(WeaponDescriptions));
            description = (WeaponDescriptions)values.GetValue(Utils.rnd.Next(values.Length));
        }
Exemple #3
0
 public void Init()
 {
     WeaponId   = -1; // -1은 인벤에 존재하지 않음을 뜻함
     Name       = "";
     FireCool   = 0.0f;
     Range      = 0.0f;
     Damage     = 0.0f;
     Price      = 0.0f;
     WeaponInfo = "";
     Grade      = -1;
     Kind       = WeaponKinds.None;
 }
Exemple #4
0
 public Weapon(int id, string name, float cool, float range, float damage, float price, int grade, WeaponKinds kind, string info)
 {
     WeaponId   = id;
     Name       = name;
     FireCool   = cool;
     Range      = range;
     Damage     = damage;
     Price      = price;
     Grade      = grade;
     Kind       = kind;
     WeaponInfo = info;
 }
Exemple #5
0
        /// <summary>
        /// Get the display color of a given weapon.
        /// </summary>
        /// <param name="Kind">Weapon kind</param>
        /// <returns>Display color of the given weapon</returns>
        public static Color WeaponKindColor(WeaponKinds Kind)
        {
            switch (Kind)
            {
            case WeaponKinds.Photon: return(new Color(0, .75f, 0));

            case WeaponKinds.Scatter: return(new Color(.75f, .375f, 0));

            case WeaponKinds.Laser: return(new Color(.75f, 0, 0));

            default: return(Color.white);
            }
        }
Exemple #6
0
        /// <summary>
        /// Add a weapon to a GameObject.
        /// </summary>
        /// <param name="Kind">Weapon kind</param>
        /// <param name="Parent">Target GameObject</param>
        /// <returns>The new weapon component on the target GameObject</returns>
        public static WeaponBase AttachWeapon(WeaponKinds Kind, GameObject Parent)
        {
            switch (Kind)
            {
            case WeaponKinds.Photon: return(Parent.AddComponent <Photon>());

            case WeaponKinds.Scatter: return(Parent.AddComponent <Scatter>());

            case WeaponKinds.Laser: return(Parent.AddComponent <Laser>());

            default: return(Parent.AddComponent <Unassigned>());
            }
        }