コード例 #1
0
ファイル: Weapon.cs プロジェクト: whztt07/SDK
 protected Quat GetFireRotation( WeaponType.WeaponMode typeMode )
 {
     Quat rot = setForceFireRotation ? forceFireRotation : Rotation;
     return rot * typeMode.StartOffsetRotation;
 }
コード例 #2
0
ファイル: Weapon.cs プロジェクト: whztt07/SDK
 protected Vec3 GetFirePosition( WeaponType.WeaponMode typeMode )
 {
     Quat rot = setForceFireRotation ? forceFireRotation : Rotation;
     return Position + rot * typeMode.StartOffsetPosition;
 }
コード例 #3
0
        //Incin - give weapons to players
        public bool GiveWeapon(WeaponType weaponType, Unit unit)
        {
            Weapon weapon = null;
            PlayerCharacter playerCharacter = null;
            playerCharacter = unit as PlayerCharacter;

            int index = GetWeaponIndex(weaponType);
            if (index == -1)
                return false;

            if (weapons[index].exists)
                return true;

            weapons[index].exists = true;
            SetActiveWeapon(index);

            if (playerCharacter != null)
            {
                weapon = playerCharacter.ActiveWeapon;
            }
            else
                return false;

            Gun gun = weapon as Gun;
            if (gun != null)
            {
                if (gun.Type.NormalMode != null && (gun.Type.NormalMode.BulletType != null && gun.Type.NormalMode.BulletCapacity != 0))
                {
                    gun.AddBullets(gun.Type.NormalMode.BulletType, gun.Type.NormalMode.BulletCapacity);
                    TakeBullets(gun.Type.NormalMode.BulletType, gun.Type.NormalMode.BulletCapacity);
                    //BulletItem bullet = (Bullet)gun.Type.NormalMode.BulletType.GetType();
                    //bullet.GiveBullets(unit);
                }
                else
                {
                    ;
                }

                if (gun.Type.AlternativeMode != null && (gun.Type.AlternativeMode.BulletType != null && gun.Type.AlternativeMode.BulletCapacity != 0))
                {
                    gun.AddBullets(gun.Type.AlternativeMode.BulletType, gun.Type.AlternativeMode.BulletCapacity);
                    TakeBullets(gun.Type.AlternativeMode.BulletType, gun.Type.AlternativeMode.BulletCapacity);
                }
                else
                {
                    ;
                }
            }

            return true;
        }
コード例 #4
0
        public bool TakeWeapon(WeaponType weaponType)
        {
            int index = GetWeaponIndex(weaponType);
            if (index == -1)
                return false;

            if (weapons[index].exists)
                return true;

            weapons[index].exists = true;

            SetActiveWeapon(index);

            return true;
        }
コード例 #5
0
 public int GetWeaponIndex(WeaponType weaponType)
 {
     for (int n = 0; n < Type.Weapons.Count; n++)
         if (Type.Weapons[n].WeaponType == weaponType)
             return n;
     return -1;
 }