public WeaponPickup(WeaponClass w,MyVector pos,MyQuaternion orientation)
     : base(new PhysicalProperties(0,0))
 {
     weaponClass = w;
     StaticBodyData data = this.StaticBodyData;
     data.Position = pos;
     data.Orientation = orientation;
     this.StaticBodyData = data;
     timeSinceLastUse = weaponClass.PickupReuseTime;
 }
Beispiel #2
0
        public Arrow(object owner, WeaponClass weaponClass, MyVector position, MyQuaternion orientation, MyVector velocity)
            : base(new PhysicalProperties(0, 0, 0))
        {
            this.owner = owner;
            this.weaponClass = weaponClass;

            PointMassData data = this.PointMassData;

            data.Position = position;
            data.Orientation = orientation;
            data.Velocity = velocity;
            data.Mass = 0;
            this.PointMassData = data;
            remainingTime = weaponClass.WeaponParameters.ParticleLifetime;
        }
Beispiel #3
0
 public SwordBlade(object owner, WeaponClass weaponClass, MyVector position, MyQuaternion orientation, MyVector velocity)
     : base(new PhysicalProperties(0, 0, 0))
 {
 }
 public WeaponWithAmmo(WeaponClass weaponClass, int ammo)
 {
     WeaponClass = weaponClass;
     Ammo = ammo;
 }
 public void SelectWeapon(WeaponClass wc)
 {
     if (wc == null)
     {
         currentMelee = -1;
         currentRanged = -1;
         return;
     }
     if (wc.WeaponType == WeaponType.Ranged)
     {
         for (int i = 0; i < ranged.Count; i++)
         {
             if (ranged[i].WeaponClass == wc)
             {
                 ranged[i].Ammo = 1000;
                 currentRanged = i;
                 return;
             }
         }
         ranged.Add(new WeaponState(wc));
         currentRanged = ranged.Count - 1;
         CurrentRanged.Ammo = 1000;
         currentType = WeaponType.Ranged;
         //if (OnWeaponChanged != null)
         //{
         //    if (CurrentWeapon != null)
         //        OnWeaponChanged(CurrentWeapon.WeaponClass);
         //    else
         //        OnWeaponChanged(null);
         //}
     }
 }
        public void RemoveWeapon(WeaponClass weaponClass)
        {
            if (weaponClass.WeaponType == WeaponType.Melee)
            {
                for (int i = 0; i < melee.Count; i++)
                {
                    if (melee[i].WeaponClass == weaponClass)
                    {

                        if (CurrentMelee.WeaponClass == weaponClass)
                        {
                            SelectPreviousMelee();
                        }
                        melee.RemoveAt(i);
                    }
                }

            }
            else if (weaponClass.WeaponType == WeaponType.Ranged)
            {
                for (int i = 0; i < ranged.Count; i++)
                {
                    if (ranged[i].WeaponClass == weaponClass)
                    {

                        if (CurrentRanged.WeaponClass == weaponClass)
                        {
                            SelectPreviousRanged();
                        }
                        ranged.RemoveAt(i);
                        break;
                    }
                }
            }
        }
        public void AddWeapon(WeaponClass weaponClass)
        {
            if (weaponClass.WeaponType == WeaponType.Melee)
            {

                for (int i = 0; i < melee.Count; i++)
                {
                    if (melee[i].WeaponClass == weaponClass)
                        return;
                }
                melee.Add(new WeaponState(weaponClass));
                if (currentType == WeaponType.Melee)
                {
                    if (autoChangeWeapons || currentMelee == -1)
                    {
                        currentMelee = melee.Count - 1;
                        if (OnWeaponChanged != null)
                            OnWeaponChanged(CurrentMelee.WeaponClass);
                    }
                }
                else
                {
                    if (autoChangeWeapons || currentRanged == -1)
                    {
                        currentMelee = melee.Count - 1;
                        if (OnWeaponChanged != null)
                            OnWeaponChanged(CurrentMelee.WeaponClass);
                    }
                    currentType = WeaponType.Melee;

                }

            }
            else if (weaponClass.WeaponType == WeaponType.Ranged)
            {
                int index = -1;
                for (int i = 0; i < ranged.Count; i++)
                {
                    if (ranged[i].WeaponClass == weaponClass)
                    {
                        index = i;
                        break;
                    }
                }
                if (index == -1)
                {
                    ranged.Add(new WeaponState(weaponClass));

                    if (currentType == WeaponType.Ranged)
                    {
                        if (autoChangeWeapons || currentMelee == -1)
                            currentRanged = ranged.Count - 1;
                    }
                    else
                    {
                        if (autoChangeWeapons || currentMelee == -1)
                        {
                            currentRanged = ranged.Count - 1;
                            if (OnWeaponChanged != null)
                                OnWeaponChanged(CurrentRanged.WeaponClass);
                        }
                        currentType = WeaponType.Ranged;

                    }
                }
                else
                {
                    ranged[index].Ammo += ranged[index].WeaponClass.AmmoInBox;
                }
            }
        }
        public UDPClientServerCommons.Constants.WeaponEnumeration GetWeaponIDByClass(WeaponClass wc, GameTeam team)
        {
            if (team == GameTeam.Assassins)
            {
                if (wc is PipeClass)
                    return  UDPClientServerCommons.Constants.WeaponEnumeration.Sword;
                if (wc is FireballClass)
                    return UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow;

            }
            else if (team == GameTeam.Knights)
            {
                if (wc is CrossbowClass)
                    return UDPClientServerCommons.Constants.WeaponEnumeration.Sword;
                if (wc is GrenadeClass)
                    return UDPClientServerCommons.Constants.WeaponEnumeration.CrossBow;

            }
            return  UDPClientServerCommons.Constants.WeaponEnumeration.None;
        }
 public WeaponPickup(WeaponClass w)
     : base(new PhysicalProperties(0, 0))
 {
     weaponClass = w;
 }
Beispiel #10
0
 public WeaponState(WeaponClass weaponClass)
 {
     this.weaponClass = weaponClass;
     ammo = weaponClass.AmmoInBox;
 }