Beispiel #1
0
        public Power(Player player)
        {
            this.player                 = player;
            this.name                   = "";
            this.powerType              = PowerType.AtWill;
            this.actionType             = PowerActionType.Standard;
            this.level                  = 1;
            this.description            = "";
            this.notes                  = "";
            this.attackType             = PowerAttackType.Weapon;
            this.attackWeapon           = WeaponSlot.MainWeapon;
            this.attackAttribute        = AttributeType.Strength;
            this.defenseType            = DefenseType.AC;
            this.weaponDamageMultiplier = 1;
            this.damageType             = "";
            this.bonusDamageAttribute   = null;
            this.attackModifiers        = new BasicAdjustmentList();
            this.damageModifiers        = new BasicAdjustmentList();

            player.PropertyChanged += new PropertyChangedEventHandler(player_PropertyChanged);

            playerWeapon = Weapon;

            if (playerWeapon != null)
            {
                playerWeapon.PropertyChanged += new PropertyChangedEventHandler(playerWeapon_PropertyChanged);
            }

            attackModifiers.CollectionChanged       += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(attackModifiers_CollectionChanged);
            attackModifiers.ContainedElementChanged += new PropertyChangedEventHandler(attackModifiers_ContainedElementChanged);
            damageModifiers.CollectionChanged       += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(damageModifiers_CollectionChanged);
            damageModifiers.ContainedElementChanged += new PropertyChangedEventHandler(damageModifiers_ContainedElementChanged);
        }
Beispiel #2
0
    // Token: 0x06001F98 RID: 8088 RVA: 0x00097844 File Offset: 0x00095A44
    private IEnumerator StartApplyDamage(WeaponSlot slot, float delay, CmunePairList <BaseGameProp, ShotPoint> hits)
    {
        yield return(new WaitForSeconds(delay));

        this.ApplyDamage(slot, hits);
        yield break;
    }
Beispiel #3
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space,
               int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
               WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range,
            origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
Beispiel #4
0
 // Token: 0x06001F7F RID: 8063 RVA: 0x00014C31 File Offset: 0x00012E31
 public void Reset()
 {
     AmmoDepot.Reset();
     this._currentSlotID.SetRange(0, 3);
     this._currentSlot = null;
     this.ShowFirstWeapon();
 }
    public void updateItemList(WeaponSlot slot)
    {
        m_Slot = slot;
        for (int i = 0; i < m_Viewport.transform.childCount; ++i)
        {
            var child = m_Viewport.transform.GetChild(i);
            Destroy(child.gameObject);
        }

        m_CurrentPerviewItem.WeaponItem = slot.m_Weapon;

        List <Weapon> weapons = new List <Weapon>();

        weapons.Add(new LightMachineGun());
        weapons.Add(new MissileStandard01());
        float height = 0;

        for (int i = 0; i < weapons.Count; ++i)
        {
            var objItem = Instantiate <GameObject>(m_PreviewItemPerfab);
            objItem.transform.SetParent(m_Viewport.transform);

            var perviewItem = objItem.GetComponent <WeaponPreviewItem>();
            perviewItem.m_WeaponDescriptionPanel = m_WeaponDescriptionPanel;
            perviewItem.WeaponItem       = weapons[i];
            perviewItem.m_OnWeaponChoice = OnWeaponChoice;
            height += perviewItem.GetComponent <RectTransform>().rect.height;
        }
        Vector2 rect = new Vector2(m_Viewport.GetComponent <RectTransform>().rect.width, m_Viewport.GetComponent <RectTransform>().rect.height);

        rect.y = height;
        var viewportTransform = m_Viewport.GetComponent <RectTransform>();

        viewportTransform.sizeDelta = rect;
    }
Beispiel #6
0
        public WeaponSpecValue(Player player, WeaponSlot slot)
        {
            this.player            = player;
            this.slot              = slot;
            this.toHitAdjustments  = new BasicAdjustmentList();
            this.damageAdjustments = new BasicAdjustmentList();

            player.PropertyChanged += new PropertyChangedEventHandler(player_PropertyChanged);

            playerWeapon = Weapon;

            if (Weapon != null)
            {
                Weapon.PropertyChanged += new PropertyChangedEventHandler(Weapon_PropertyChanged);
            }

            if (Weapon != null)
            {
                weaponBonus = player.WeaponBonuses[Weapon];

                if (weaponBonus != null)
                {
                    weaponBonus.PropertyChanged += new PropertyChangedEventHandler(bonus_PropertyChanged);
                }
            }

            toHitAdjustments.ContainedElementChanged  += new PropertyChangedEventHandler(toHitAdjustments_ContainedElementChanged);
            toHitAdjustments.CollectionChanged        += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(toHitAdjustments_CollectionChanged);
            damageAdjustments.ContainedElementChanged += new PropertyChangedEventHandler(damageAdjustments_ContainedElementChanged);
            damageAdjustments.CollectionChanged       += new System.Collections.Specialized.NotifyCollectionChangedEventHandler(damageAdjustments_CollectionChanged);
        }
Beispiel #7
0
 static public int get_position(IntPtr l)
 {
     try {
                     #if DEBUG
         var    method     = System.Reflection.MethodBase.GetCurrentMethod();
         string methodName = GetMethodName(method);
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.BeginSample(methodName);
                     #else
         Profiler.BeginSample(methodName);
                     #endif
                     #endif
         WeaponSlot self = (WeaponSlot)checkSelf(l);
         pushValue(l, true);
         pushValue(l, self.position);
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
             #if DEBUG
     finally {
                     #if UNITY_5_5_OR_NEWER
         UnityEngine.Profiling.Profiler.EndSample();
                     #else
         Profiler.EndSample();
                     #endif
     }
             #endif
 }
Beispiel #8
0
    public void EquipWeapon(WeaponSlot _slot)
    {
        switch (_slot)
        {
        case WeaponSlot.Primary:
            if (primaryWeapon != null)
            {
                currentWeapon     = primaryWeapon;
                currentWeaponSlot = WeaponSlot.Primary;
                print("Primary equipped");
                ChangeCurrentVisual();
            }
            break;

        case WeaponSlot.Secondary:
            if (secondaryWeapon != null)
            {
                currentWeapon     = secondaryWeapon;
                currentWeaponSlot = WeaponSlot.Secondary;
                print("Secondary equipped");
                ChangeCurrentVisual();
            }
            break;
        }
    }
Beispiel #9
0
        protected void LoadBaseData(BinaryReader BR)
        {
            this.Description = BR.ReadString();
            this.Price       = BR.ReadInt32();

            this.BaseHP       = BR.ReadInt32();
            this.BaseEN       = BR.ReadInt32();
            this.BaseArmor    = BR.ReadInt32();
            this.BaseMobility = BR.ReadInt32();
            this.BaseMovement = BR.ReadSingle();

            #region Weapons

            int ListWeaponSlotCount = BR.ReadInt32();
            this.ListWeaponSlot = new List <WeaponSlot>(ListWeaponSlotCount);

            for (int S = 0; S < ListWeaponSlotCount; S++)
            {
                int        ListWeaponCount = BR.ReadInt32();
                WeaponSlot ListWeapon      = new WeaponSlot(ListWeaponCount);
                for (int W = 0; W < ListWeaponCount; W++)
                {
                    string WeaponName = BR.ReadString();
                    ListWeapon.ListWeaponSlot.Add(WeaponName);
                }

                this.ListWeaponSlot.Add(ListWeapon);
            }

            #endregion
        }
Beispiel #10
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
                   RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
                   string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List <Squadron>(Strength * 3);
 }
Beispiel #11
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, 
     int sp, int str, string damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : this(name, type, hulls, slots, power, space, sp, str, new DiceRoll(damage), crit, range, 
     origin, page, quality, wq, special, turbo, comp, cond)
 {
 }
    public void Unequip(WeaponSlot slot)
    {
        switch (slot)
        {
        case WeaponSlot.LEFT_HAND:
            if (LeftHand != null)
            {
                m_EquippableItems.Add(LeftHand);
                LeftHand.Active = false;
                LeftHand.ToggleItem(false);
                GameController.InvokeUnequippedWeapon(this, Owner, LeftHand);
            }
            LeftHand = null;
            break;

        case WeaponSlot.RIGHT_HAND:
            if (RightHand != null)
            {
                m_EquippableItems.Add(RightHand);
                RightHand.Active = false;
                RightHand.ToggleItem(false);
                GameController.InvokeUnequippedWeapon(this, Owner, RightHand);
            }
            RightHand = null;
            break;
        }
    }
Beispiel #13
0
 private void Awake()
 {
     slot         = GameObject.FindGameObjectWithTag("WeaponSlot").GetComponent <WeaponSlot>();
     layerMask    = new int[2];
     layerMask[0] = (-1) - (1 << 9);
     layerMask[1] = (-1) - (1 << 14);
 }
Beispiel #14
0
    void ModifyEnemyByLevel(GameObject enemyGO)
    {
        int level = WorldManager.Instance.GetCurrentLevel();



        Unit[] us = enemyGO.GetComponentsInChildren <Unit>();

        foreach (Unit u in us)
        {
            u.Health  = (int)((float)u.Health * (1 + (float)level / 4f));
            u.Health += (level / 3);

            WeaponSlot ws = enemyGO.GetComponent <WeaponSlot>();
            if (ws != null)
            {
                ws.FireRateBonus = (float)level * 0.05f;
                ws.multishot    += (level / 4);

                /*if(ws.multishot > 9)
                 * {
                 *  ws.DamageBonus = ws.multishot - 9;
                 *  ws.multishot = 9;
                 * }*/
            }
        }
    }
Beispiel #15
0
    // Token: 0x06001F7E RID: 8062 RVA: 0x000971EC File Offset: 0x000953EC
    public void InitializeAllWeapons(Transform attachPoint)
    {
        for (int i = 0; i < this._weapons.Length; i++)
        {
            if (this._weapons[i] != null && this._weapons[i].Decorator != null)
            {
                UnityEngine.Object.Destroy(this._weapons[i].Decorator.gameObject);
            }
            this._weapons[i] = null;
        }
        for (int j = 0; j < LoadoutManager.WeaponSlots.Length; j++)
        {
            global::LoadoutSlotType slot = LoadoutManager.WeaponSlots[j];
            InventoryItem           inventoryItem;
            if (Singleton <LoadoutManager> .Instance.TryGetItemInSlot(slot, out inventoryItem))
            {
                WeaponSlot weaponSlot = new WeaponSlot(slot, inventoryItem.Item, attachPoint, this);
                this.AddGameLogicToWeapon(weaponSlot);
                this._weapons[j] = weaponSlot;
                AmmoDepot.SetMaxAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).MaxAmmo);
                AmmoDepot.SetStartAmmoForType(inventoryItem.Item.View.ItemClass, ((UberStrikeItemWeaponView)inventoryItem.Item.View).StartAmmo);
                this.SetSlotWeapon(slot, inventoryItem.Item);
            }
            else
            {
                this.SetSlotWeapon(slot, null);
            }
        }
        GameState.Current.PlayerData.LoadoutWeapons.Value = this.LoadoutWeapons;
        Singleton <QuickItemController> .Instance.Initialize();

        this.Reset();
    }
Beispiel #16
0
        public void AddWeapon(WeaponSlot facing, Weapon weapon, int count, bool update = true, bool enabled = true)
        {
            UserControl NewWeapon = null;

            if (weapon == null || weapon.Type == WeaponType.Macrobattery || weapon.Type == WeaponType.Lance)
            {
                NewWeapon = new WeaponTemplate(facing, this, count, weapon, Starship.MacrobatteryModifier);
            }
            else if (weapon.Type == WeaponType.TorpedoTube)
            {
                NewWeapon = new AmmoWeapon(facing, this, count, weapon as TorpedoTubes, enabled);
            }
            else if (weapon.Type == WeaponType.LandingBay)
            {
                NewWeapon = new AmmoWeapon(facing, this, count, weapon as LandingBay, enabled);
            }
            else if (weapon.Type == WeaponType.NovaCannon)
            {
                NewWeapon = new NovaCannonTemplate(facing, this, count, weapon as NovaCannon, enabled);
            }
            if (NewWeapon != null)
            {
                Grid.SetRow(NewWeapon, WeaponRowCount++);//Add the extra row as you place this one
                Grid.SetColumnSpan(NewWeapon, 7);
                Weapons.Children.Add(NewWeapon);
                if (weapon != null && update)
                {
                    UpdateSP();
                    UpdateUsedSpace();
                    UpdateUsedPower();
                }
            }
        }
Beispiel #17
0
        internal void Update()
        {
            if (!_gameObject.Definition.WeaponSets.TryGetValue(_gameObject.WeaponSetConditions, out var weaponTemplateSet))
            {
                return;
            }

            if (_currentWeaponTemplateSet == weaponTemplateSet)
            {
                return;
            }

            _currentWeaponTemplateSet = weaponTemplateSet;

            _currentWeaponSlot = WeaponSlot.Primary;

            _filledWeaponSlots = 0;
            _combinedAntiMask  = WeaponAntiFlags.None;

            for (var i = 0; i < _weapons.Length; i++)
            {
                var weaponTemplate = _currentWeaponTemplateSet.Slots[i]?.Weapon.Value;
                if (weaponTemplate != null)
                {
                    _weapons[i] = new Weapon(_gameObject, weaponTemplate, (WeaponSlot)i, _gameObject.GameContext);

                    _filledWeaponSlots |= (uint)(1 << i);
                    _combinedAntiMask  |= weaponTemplate.AntiMask;
                }
            }
        }
Beispiel #18
0
        public void ChangeWeapon(int index)
        {
            WeaponSlot weaponType = Starship.WeaponList[index].Item1;

            if (weaponType == WeaponSlot.Prow)//Heavy weapons can be on all prows if they can be on a ship
            {
                weaponType |= WeaponSlot.Heavy;
            }
            if (((Starship.Hull.HullTypes & HullType.AllCruiser) != 0) || (weaponType & WeaponSlot.Prow) != 0)//lances can be on all prows or any slot of ships bigger than frigates, raiders or transports
            {
                weaponType |= WeaponSlot.Lance;
            }
            if ((Starship.Hull.HullTypes & (HullType.GrandCruiser | HullType.BattleShip)) != 0 && (weaponType & WeaponSlot.Dorsal) != 0)//Grand cruisers may have heavy weapons in dorsal slots
            {
                weaponType |= WeaponSlot.Heavy;
            }
            //Open weapon chooser
            WeaponChooser dialog = new WeaponChooser(Starship, weaponType, index, loader);

            dialog.ShowDialog();
            if (dialog.DialogResult ?? false)
            {
                UpdateWeaponSlots(true);
            }
        }
Beispiel #19
0
    public ItemSlot TakeItem(CollectibleItem item)
    {
        if (item == null)
        {
            return(null);
        }

        WeaponSlot weapon = WeaponsSlots.Find(lambdaExpression =>
                                              lambdaExpression.BulletType == item.ItemType);

        if (weapon != null)
        {
            AddAmmo(weapon, item.Quantity);
            return(null);
        }

        if (item.ItemType == ItemType.Nothing)
        {
            return(null);
        }

        if (item.ItemInstance == null && !item.Unequipable)
        {
            return(null);
        }

        return(AddItem(item));
    }
Beispiel #20
0
 /// <summary>
 /// Create a new Landing Bay
 /// </summary>
 /// <param name="name">name of the landing bay</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="capacity">total ammo capacity of the torpedo tube</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 public LandingBay(string name, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     RuleBook origin, byte page, Quality quality = Quality.Common, WeaponQuality wq = WeaponQuality.None,
     string special = null, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, WeaponType.LandingBay, hulls, slots, power, space, sp, str, default(DiceRoll), 0, 0, origin, page, quality, wq, special, Quality.None, comp, cond)
 {
     Squadrons = new List<Squadron>(Strength * 3);
 }
Beispiel #21
0
    public Weapon AssignWeapon(WeaponSlot slot, Weapon weapon)
    {
        Weapon old = m_weapons[(int)slot];

        m_weapons[(int)slot] = weapon;
        return(old);
    }
Beispiel #22
0
        }                                    //Should probably be a float, if game speed will be measured in seconds

        public Weapon(String name, WeaponSlot weaponSlot, WeaponType weaponType, int attackValue, int attackSpeed, Boolean isLootable, int durability) : base(name, isLootable, durability)
        {
            this.weaponSlot  = weaponSlot;
            this.weaponType  = weaponType;
            this.attackValue = attackValue;
            this.attackSpeed = attackSpeed;
        }
Beispiel #23
0
    void Awake()
    {
        health = maxHealth;

        rb = GetComponent <Rigidbody>();

        fuelSlot = GetComponentInChildren <ModuleSlot>();
        if (fuelSlot == null || fuelSlot.slotType != GameTypes.ModuleType.FuelPack)
        {
            Debug.LogError("Player: No fuel slot set as child");
        }

        weaponSlot = GetComponentInChildren <WeaponSlot>();
        if (weaponSlot == null)
        {
            Debug.LogError("Player: No weapon slot set as child");
        }

        if (cameraRig == null)
        {
            Debug.LogError("Player: No camera rig set in inspector");
        }

        PlayerControl.instance.TakeControl(this);

        StartCoroutine("WeaponTimer");
    }
Beispiel #24
0
        public override void WriteToStream(Stream stream)
        {
            BinaryWriter writer = new BinaryWriter(stream);

            writer.Write((byte)BaseFlags);
            writer.Write(Portrait);
            writer.Write(ID);
            writer.Write(Level);
            writer.Write((byte)Class);
            writer.Write((byte)Subclass);
            writer.Write((ushort)StatusAilments);
            WeaponSlot.WriteToStream(stream);
            EquipmentSlot.WriteToStream(stream);
            ArmorSlot1.WriteToStream(stream);
            ArmorSlot2.WriteToStream(stream);
            writer.Write(Unknown1);
            writer.Write(Unknown2);
            writer.Write(Unknown3);
            writer.Write(Unknown4);
            writer.Write(Unknown5);
            BaseStats.WriteToStream(stream);
            CumulativeStatsAfterSkills.WriteToStream(stream);
            CumulativeStatsAfterEquipment.WriteToStream(stream);
            CumulativeStatsAfterUnknown1.WriteToStream(stream);
            CumulativeStatsAfterUnknown2.WriteToStream(stream);
            CumulativeStatsAfterUnknown3.WriteToStream(stream);
            writer.Write(CurrentHP);
            writer.Write(CurrentTP);
            writer.Write(CurrentEXP);
            writer.Write(name);
            writer.Write(NamePadding);
            writer.Write(UnknownTotalSkillPoints);
            writer.Write(AvailableSkillPoints);
            writer.Write(MainSkillLevels);
            writer.Write(SubSkillLevels);
            writer.Write(Unknown6);
            writer.Write(BookSTRModifier);
            writer.Write(BookVITModifier);
            writer.Write(BookAGIModifier);
            writer.Write(BookLUCModifier);
            writer.Write(BookTECModifier);
            writer.Write(Unknown7);
            writer.Write(Unknown8);
            writer.Write(Unknown9);
            writer.Write(Unknown10);
            writer.Write(Unknown11);
            writer.Write(Unknown12);
            writer.Write(Unknown13);
            writer.Write(Unknown14);
            writer.Write(Unknown15);
            writer.Write(Unknown16);
            writer.Write(Unknown17);
            writer.Write(Unknown18);
            writer.Write(DuplicateID);
            writer.Write(PartySlot);
            writer.Write(Unknown19);
            writer.Write(originGuildName);
            writer.Write(Unknown20);
        }
 public void Remove(WeaponSlot slot)
 {
     if (this.weapons.TryGetValue(slot, out var weapon))
     {
         this.weapons.Remove(slot);
         this.WeaponRemoved?.Invoke(this, weapon);
     }
 }
 private void Inject(WeaponSlot weaponSlot,
                     WeaponAim weaponAim,
                     [Inject(Id = "Player")] Transform playerTransform)
 {
     _weaponSlot = weaponSlot;
     _weaponAim = weaponAim;
     _playerTransform = playerTransform;
 }
Beispiel #27
0
        public void UnequipAll()
        {
            WeaponSlot.Unequip();   // ensure this item's Unequip effects happen
            WeaponSlot = new NoEquipment();

            HelmetSlot.Unequip();   // ensure this item's Unequip effets happen
            HelmetSlot = new NoEquipment();
        }
Beispiel #28
0
    // Выбираем оружие
    public void SelectWeapon(int index)
    {
        currentWeapon.Select(false, scaleMultiplier, animationTime, defaultWeaponSlotColor);

        currentWeapon = weaponSlots[index];

        currentWeapon.Select(true, scaleMultiplier, animationTime, defaultWeaponSlotColor);
    }
 public void Initialise(bool local)
 {
     if (local)
     {
         weaponSlot  = GetComponentInParent <WeaponSlot>();
         initialised = true;
     }
 }
Beispiel #30
0
 public void FinishPurchaseWeapon(WeaponSlot weaponSlot)
 {
     Debug.Assert(playerScoreInfo.CanBuyWeapon(weaponBeingPurchased));
     playerScoreInfo.Decrement(weaponBeingPurchased.scoreWorth);
     weaponSlot.SetWeapon(weaponBeingPurchased);
     weaponBeingPurchased = null;
     ShowSelectWeapon();
 }
 public Weapon this[WeaponSlot slot] {
     get {
         return(GetEquippedItem(slot));
     }
     set {
         Equip(value, slot);
     }
 }
Beispiel #32
0
        static GameObject RespawnFx(GameObject prefab, ItemEntity item)
        {
            WeaponSlot weaponSlot = item.HoldingSlot as WeaponSlot;
            var        weaponSnap = weaponSlot?.FxSnapMap;
            var        unit       = item.Wielder.Unit?.View;

            return(FxHelper.SpawnFxOnWeapon(prefab, unit, weaponSnap));
        }
Beispiel #33
0
 /// <summary>
 /// Public constructors called for TorpedoTubes or Landing Bay, private constructor to handle either in same manner as WeaponTemplate
 /// </summary>
 /// <param name="facing">Weapon slot</param>
 /// <param name="weapon">Torpedo tube or Landing Bay</param>
 private AmmoWeapon(WeaponSlot facing, StarshipCreator parent, int index, Weapon weapon, bool enabled)
 {
     this.Parent = parent;
     this.Index = index;
     InitializeComponent();
     this.WeaponFacing = facing;
     Facing.Content = WeaponFacing.ToString();
     this.Weapon = weapon;
     if (!enabled)
     {
         WeaponChoice.Visibility = Visibility.Collapsed;
         WeaponName.Visibility = Visibility.Visible;
     }
 }
Beispiel #34
0
 /// <summary>
 /// Create a new weapon
 /// </summary>
 /// <param name="name">name of the weapon</param>
 /// <param name="type">class of weapon</param>
 /// <param name="hulls">class fo ship that can mount this weapon</param>
 /// <param name="slots">locatiosn where this weapon can be mounted</param>
 /// <param name="power">power used by this weapon</param>
 /// <param name="space">space used by this method</param>
 /// <param name="sp">cost of this weapon</param>
 /// <param name="str">strength of the weapon</param>
 /// <param name="damage">damage of the weapon</param>
 /// <param name="crit">crit rating of the weapon</param>
 /// <param name="range">range of the weapon</param>
 /// <param name="origin">rulebook containing this weapon</param>
 /// <param name="page">page this weapon can be found on</param>
 /// <param name="quality">quality of this weapon</param>
 /// <param name="wq">enum declaring which qualities to be adjusted</param>
 /// <param name="special">special rules of this weapon</param>
 /// <param name="turbo">Quality of turboweapon battery upgrade if applicable</param>
 public Weapon(string name, WeaponType type, HullType hulls, WeaponSlot slots, int power, int space, int sp, int str,
     DiceRoll damage, int crit, int range, RuleBook origin, byte page, Quality quality = Quality.Common,
     WeaponQuality wq = WeaponQuality.None, string special = null, Quality turbo = Quality.None, ComponentOrigin comp = ComponentOrigin.Standard, Condition cond = Condition.Intact)
     : base(name, sp, power, space, special, origin, page, hulls, quality, comp, cond)
 {
     this.Type = type;
     this.Slots = slots;
     this.Strength = str;
     this.Damage = damage;
     this.Crit = crit;
     this.Range = range;
     this.WeaponQuality = wq;
     this.TurboWeapon = turbo;
 }
Beispiel #35
0
 //Also pass in method for button - do after making said method
 public WeaponTemplate(WeaponSlot facing, StarshipCreator parent, int index, Weapon weapon = null, int macrodamage = 0, bool enabled = true)
 {
     this.Parent = parent;
     this.Index = index;
     InitializeComponent();
     this.WeaponFacing = facing;
     Facing.Content = WeaponFacing.ToString();
     this.Weapon = weapon;
     Macrodamage = macrodamage;
     if (!enabled)
     {
         WeaponChoice.Visibility = Visibility.Collapsed;
         WeaponName.Visibility = Visibility.Visible;
     }
 }
Beispiel #36
0
 public AmmoWeapon(WeaponSlot facing, StarshipCreator parent, int index, LandingBay weapon, bool enabled = true)
     : this(facing, parent, index, (Weapon)weapon, enabled)
 {
     AmmoButton.Content = "Squadrons";
     Tubes = false;
 }
Beispiel #37
0
 public AmmoWeapon(WeaponSlot facing, StarshipCreator parent, int index, TorpedoTubes weapon, bool enabled = true)
     : this(facing, parent, index, (Weapon)weapon, enabled)
 {
     AmmoButton.Content = "Torpedoes";
     Tubes = true;
 }
Beispiel #38
0
    void Start()
    {
        disable_springs = false;
        disable_recoil = true;
        holder = GameObject.Find("gui_skin_holder").GetComponent<GUISkinHolder>();
        weapon_holder = holder.weapon.GetComponent<WeaponHolder>();
        magazine_obj = weapon_holder.mag_object;
        gun_obj = weapon_holder.gun_object;
        casing_with_bullet = weapon_holder.bullet_object;

        if(Random.Range(0.0f,1.0f) < 0.35f){
            held_flashlight = Instantiate(holder.flashlight_object);
            held_flashlight.GetComponent<FlashlightScript>().TurnOn();
            holder.has_flashlight = true;
        }

        rotation_x = transform.rotation.eulerAngles.y;
        view_rotation_x = transform.rotation.eulerAngles.y;
        gun_instance = Instantiate(gun_obj);
        var renderers = gun_instance.GetComponentsInChildren<Renderer>();
        foreach (Renderer renderer in renderers)
        {
            renderer.shadowCastingMode = ShadowCastingMode.On;
        }
        main_camera = GameObject.Find("Main Camera").gameObject;
        character_controller = GetComponent<CharacterController>();
        for(var i=0; i<kMaxHeadRecoil; ++i){
            head_recoil_delay[i] = -1.0f;
        }
        for(var i=0; i<10; ++i){
            weapon_slots[i] = new WeaponSlot();
        }
        var num_start_bullets = 30;// Random.Range(0, 10);
        if(GetGunScript().gun_type == GunType.AUTOMATIC){
            var num_start_mags= Random.Range(0,3);
            for(var i=1; i<num_start_mags+1; ++i){
                weapon_slots[i].type = WeaponSlotType.MAGAZINE;
                weapon_slots[i].obj = Instantiate(magazine_obj);
            }
        } else {
            num_start_bullets += Random.Range(0,20);
        }
        loose_bullets = new List<GameObject>();
        loose_bullet_spring = new List<Spring>();
        for(var i=0; i<num_start_bullets; ++i){
            AddLooseBullet(false);
        }
        audiosource_tape_background = gameObject.AddComponent<AudioSource>();
        audiosource_tape_background.loop = true;
        audiosource_tape_background.clip = holder.sound_tape_background;
        audiosource_audio_content = gameObject.AddComponent<AudioSource>();
        audiosource_audio_content.loop = false;

        //int count= 0;
        foreach(var tape in holder.sound_tape_content){
            total_tapes.Add(tape);
            /*++count;
            if(count >= 2){
                break;
            }*/
        }
        var temp_total_tapes= new List<AudioClip>(total_tapes);
        while(temp_total_tapes.Count > 0){
            var rand_tape_id= Random.Range(0,temp_total_tapes.Count);
            tapes_remaining.Add(temp_total_tapes[rand_tape_id]);
            temp_total_tapes.RemoveAt(rand_tape_id);
        }
    }
Beispiel #39
0
 public WeaponChooser(Starship starship, WeaponSlot slot, int index, Loader loader)
 {
     if (starship == null || starship.Hull == null)
         throw new ArgumentException("Cannot create weapon chooser without starship or hull");
     this.Starship = starship;
     this.Index = index;
     WeaponRowCount = 0;
     InitializeComponent();
     Label label;
     Button button;
     TextBox textbox;
     TextBlock textblock;
     button = new Button();
     button.Content = "Clear Weapon";
     button.Click += ((s, e) => SetCurrent(null));
     Grid.SetRow(button, WeaponRowCount);
     Grid.SetColumn(button, 0);
     WeaponGrid.Children.Add(button);
     foreach (var group in loader.Weapons.Where(x => (x.HullTypes & starship.Hull.HullTypes) != 0 && (x.Slots & slot) != 0).GroupBy(x => x.ComponentOrigin).OrderBy(x => x.Key))
     {
         if (group.Key != ComponentOrigin.Standard)
         {
             label = new Label();
             label.Content = group.Key.ToString();
             Grid.SetRow(label, WeaponRowCount++);
             Grid.SetColumn(label, 0);
             WeaponGrid.Children.Add(label);
         }
         foreach (Weapon weapon in group)
         {
             button = new Button();
             button.Content = weapon.Name;
             button.Click += ((s,e) => SetCurrent(weapon, weapon.Quality, weapon.WeaponQuality));
             Grid.SetRow(button, WeaponRowCount);
             Grid.SetColumn(button, 0);
             WeaponGrid.Children.Add(button);
             textbox = new TextBox();
             textbox.Text = weapon.Type.ToString();
             textbox.IsReadOnly = true;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 1);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Power.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 2);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Space.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 3);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.SP.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 4);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Strength.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 5);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Damage.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 6);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.DisplayRange;
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 7);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Crit.ToString();
             textbox.IsReadOnly = true;
             textbox.TextAlignment = TextAlignment.Center;
             Grid.SetRow(textbox, WeaponRowCount);
             Grid.SetColumn(textbox, 8);
             WeaponGrid.Children.Add(textbox);
             textbox = new TextBox();
             textbox.Text = weapon.Origin.Name();
             textbox.IsReadOnly = true;
             textbox.ToolTip = weapon.Origin.LongName() + ", Page: " + weapon.PageNumber;
             Grid.SetRow(textbox, WeaponRowCount++);
             Grid.SetColumn(textbox, 10);
             WeaponGrid.Children.Add(textbox);
             if (!String.IsNullOrWhiteSpace(weapon.Description))
             {
                 textblock = new TextBlock();
                 textblock.Text = weapon.Description;
                 textblock.Margin = new Thickness(2, 2, 2, 2);
                 textblock.TextWrapping = TextWrapping.WrapWithOverflow;
                 Grid.SetRow(textblock, WeaponRowCount++);
                 Grid.SetColumnSpan(textblock, 11);
                 WeaponGrid.Children.Add(textblock);
             }
         }
     }
     Current = Starship.Weapons[Index];
     UpdateCurrent();
 }
Beispiel #40
0
    // Use this for initialization
    void Start()
    {
        if (displayManager == null)
        {
            displayManager = ObjectManager.Instance.weaponDisplayManager;
        }

        primaryWeaponIndex = Globals.Instance.equippedPrimaryWeapon;
        secondaryWeaponIndex = Globals.Instance.equippedSecondaryWeapon;

        DebugLogger.Log("WeaponController::Start()");

        weaponSlots = new Dictionary<WeaponLocation, WeaponSlot>();

        WeaponSlot slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Primary;
        slot.displayManager = displayManager;
        slot.weaponAnimator = primaryWeaponAnimator;
        slot.equippedWeaponIndex = primaryWeaponIndex;
        slot.cycledWeaponIndex = primaryWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = primaryWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Primary, slot);

        slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Secondary;
        slot.displayManager = displayManager;
        slot.weaponAnimator = secondaryWeaponAnimator;
        slot.equippedWeaponIndex = secondaryWeaponIndex;
        slot.cycledWeaponIndex = secondaryWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = secondaryWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Secondary, slot);

        slot = new WeaponSlot();

        slot.weaponLocation = WeaponLocation.Utility;
        slot.displayManager = displayManager;
        slot.weaponAnimator = null;
        slot.equippedWeaponIndex = utilityWeaponIndex;
        slot.cycledWeaponIndex = utilityWeaponIndex;
        slot.weaponSelectionDelay = weaponSelectionDelay;
        slot.weaponList = utilityWeapons;
        slot.equipSound = equipSound;
        slot.unequipSound = unequipSound;
        slot.weaponCycleSound = weaponCycleSound;
        slot.weaponSelectSound = weaponSelectSound;

        slot.Initialize();

        weaponSlots.Add(WeaponLocation.Utility, slot);

        //EquipCurrentWeapon(WeaponLocation.Primary);
        //EquipCurrentWeapon(WeaponLocation.Secondary);
        //EquipCurrentWeapon(WeaponLocation.Utility);
    }
Beispiel #41
0
    static void MenuDumpModels()
    {
        GameObject go = Selection.activeGameObject;
		go.AddComponent<Outfitter>();
		go.AddComponent<CharacterDemoController>();

		Transform[] tms = go.transform.GetComponentsInChildren<Transform>();
		
		foreach(Transform tm in tms)
		{
			if(tm.gameObject.GetComponent<Renderer>()!=null)
			{
				tm.gameObject.GetComponent<Renderer>().enabled = false;				
			}
		}

		Outfitter o = go.transform.GetComponent<Outfitter>();
		o.weapons = new List<WeaponSlot>();
		WeaponSlot weap = new WeaponSlot();
		for(int i = 0;i<9;i++)
		{
			weap = new WeaponSlot();
			o.weapons.Add(weap);
			o.weapons[i].models = new List<Renderer>();
		}

		foreach(Transform tm in tms)
		{
			if(tm.gameObject.name.ToLower() == "gladius02")
			{

				o.weapons[1].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "longsword")
			{
				o.weapons[2].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "bow")
			{
				o.weapons[3].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "gladius02")
			{
				o.weapons[4].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.Contains("Pistol"))
			{
				o.weapons[5].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.Contains("SpaceRifle"))
			{
				o.weapons[6].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "spear")
			{
				o.weapons[7].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "broadsword")
			{
				o.weapons[8].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
		}
		foreach(Transform tm in tms)
		{
			if(tm.gameObject.name.ToLower() == "gladius")
			{
				o.weapons[4].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "arrow")
			{
				o.weapons[3].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
			if(tm.gameObject.name.ToLower() == "shield01")
			{
				o.weapons[8].models.Add(tm.gameObject.GetComponent<Renderer>());
			}
		}
		CharacterDemoController cdc = go.transform.GetComponent<CharacterDemoController>();
		cdc.floorPlane = GameObject.Find("Plane");
		GameObject goct= GameObject.Find("CameraTarget");
		CamTarget ct = goct.GetComponent<CamTarget>();
		ct.target = go.transform;
    } 
 public void AddWeapon(WeaponSlot facing, Weapon weapon, int count, bool update = true, bool enabled = true)
 {
     UserControl NewWeapon = null;
     if (weapon == null || weapon.Type == WeaponType.Macrobattery || weapon.Type == WeaponType.Lance)
         NewWeapon = new WeaponTemplate(facing, this, count, weapon, Starship.MacrobatteryModifier);
     else if (weapon.Type == WeaponType.TorpedoTube)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as TorpedoTubes, enabled);
     else if (weapon.Type == WeaponType.LandingBay)
         NewWeapon = new AmmoWeapon(facing, this, count, weapon as LandingBay, enabled);
     else if (weapon.Type == WeaponType.NovaCannon)
         NewWeapon = new NovaCannonTemplate(facing, this, count, weapon as NovaCannon, enabled);
     if (NewWeapon != null)
     {
         Grid.SetRow(NewWeapon, WeaponRowCount++);//Add the extra row as you place this one
         Grid.SetColumnSpan(NewWeapon, 7);
         Weapons.Children.Add(NewWeapon);
         if (weapon != null && update)
         {
             UpdateSP();
             UpdateUsedSpace();
             UpdateUsedPower();
         }
     }
 }
 public void remove(WeaponSlot slot)
 {
     equippedWeapons.Remove(slot);
 }
Beispiel #44
0
        public void AddWeaponSlot(SlotItem item)
        {
            WeaponSlot slot = new WeaponSlot(item, outline);

            HudElements.Add(slot);

            currentSlots++;
        }
Beispiel #45
0
 public void EquipWeapon(Weapon weapon, WeaponSlot destinationSlot)
 {
     switch (destinationSlot)
     {
         case WeaponSlot.Main:
             Equipment.MainWeapon = weapon;
             break;
         case WeaponSlot.Secondary:
             Equipment.SecondaryWeapon = weapon;
             break;
     }
 }
 public void add(WeaponSlot slot, EquipableItem item)
 {
     equippedWeapons.Add(slot, item);
 }