Exemplo n.º 1
0
    // ----------

    void OnGUI()
    {
        if (!Managers.Game.paused)
        {
            // GUI while the game is running
            GUI.Box(statsRect, "Time: " + minutes + ":" + seconds +
                    "\n\nRemaining: " + this.remainingEnemies +
                    "\nShots fired: " + CWeapon.GetShotsFired() +
                    "\nAccuracy: " + CWeapon.GetAccuracy() + "%"                                        // The accuracy is refreshed on each confirmed hit.
                    );
            GUI.Box(scoreRect, "Score: " + Managers.Game.GetScore());
            GUI.Box(livesRect, "Lives: " + CShip.GetLives());
        }
        else if (Managers.Game.paused)
        {
            // GUI while the game is paused.
            if (GUI.Button(new Rect((scrWid / 2) - (boxWid / 2), (scrHei / 2) - (boxHei / 2), boxWid, boxHei / 3), "Continue"))
            {
                Managers.Game.PauseSwitch();
            }
            if (GUI.Button(new Rect((scrWid / 2) - (boxWid / 2), (scrHei / 2) - (boxHei / 6) + 5, boxWid, boxHei / 3), "Close game"))
            {
                Application.Quit();
            }
        }
    }
Exemplo n.º 2
0
        public void AddWeapon(CWeapon weapon, bool lWeapon)
        {
            // TODO: 2handed weapon check
            if (lWeapon)
            {
                this._lWeapon = weapon;
                var mods = new Pair <object, List <StatMod> >(weapon, weapon.Model.GetStatModifiers());

                foreach (var perk in this._parent.GetPerks().GetEquipmentSStatPerks())
                {
                    perk.TryModEquipmentMod(mods);
                }
                //foreach (var perk in this._parent.GetPerks().GetEquipmentPerks())
                //    perk.TryProcessAdd(this._parent, weapon);
                // TODO

                this._parent.GetStatMods().AddMod(mods);
            }
            else
            {
                this._rWeapon = weapon;
                var mods = new Pair <object, List <StatMod> >(weapon, weapon.Model.GetStatModifiers());

                foreach (var perk in this._parent.GetPerks().GetEquipmentSStatPerks())
                {
                    perk.TryModEquipmentMod(mods);
                }
                //foreach (var perk in this._parent.GetPerks().GetEquipmentPerks())
                //    perk.TryProcessAdd(this._parent.Controller.Proxy, weapon);
                // TODO

                this._parent.GetStatMods().AddMod(mods);
            }
        }
Exemplo n.º 3
0
    public CWeapon GetWeapon()
    {
        IntPtr  cPtr = testPINVOKE.CProjectile_GetWeapon(swigCPtr);
        CWeapon ret  = (cPtr == IntPtr.Zero) ? null : new CWeapon(cPtr, false);

        return(ret);
    }
Exemplo n.º 4
0
 public CProjectile(CProjectileProfile Profile, CWeapon Weapon, bool IsVisible, bool UsePhysics) : this(testPINVOKE.new_CProjectile__SWIG_0(CProjectileProfile.getCPtr(Profile), CWeapon.getCPtr(Weapon), IsVisible, UsePhysics), true)
 {
     if (testPINVOKE.SWIGPendingException.Pending)
     {
         throw testPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 5
0
 public CProjectile(CProjectileProfile Profile, CWeapon Weapon) : this(testPINVOKE.new_CProjectile__SWIG_2(CProjectileProfile.getCPtr(Profile), CWeapon.getCPtr(Weapon)), true)
 {
     if (testPINVOKE.SWIGPendingException.Pending)
     {
         throw testPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 6
0
 public CMagazine(CMagazineProfile Profile, CWeapon Weapon) : this(testPINVOKE.new_CMagazine(CMagazineProfile.getCPtr(Profile), CWeapon.getCPtr(Weapon)), true)
 {
     if (testPINVOKE.SWIGPendingException.Pending)
     {
         throw testPINVOKE.SWIGPendingException.Retrieve();
     }
 }
Exemplo n.º 7
0
    public void SetCurrentWeapon(CWeapon weapon)
    {
        if (this.currentWeapon != null)
        {
            this.currentWeapon.gameObject.SetActive(false);
        }
        currentWeapon = weapon;
        this.currentWeapon.gameObject.SetActive(true);

        currentWeapon.MadeBulletString();
        if (playerShooter == null)
        {
            weaponParent.GetComponentInParent <CShooter>().SetCurrentWeapon(currentWeapon);
        }

        else
        {
            playerShooter.SetCurrentWeapon(currentWeapon);
        }

        if (gunUIImage == null)
        {
            gunUIImage = GameObject.Find("Canvas_UI").transform.Find("Gun_UI").GetComponent <Image>();
        }

        gunUIImage.sprite = currentWeapon.weaponUIImage;
        weapon.SetCameraShake();
    }
Exemplo n.º 8
0
    public void EquipmentChange(int nIdx)
    {
        if (m_inventory == null)
        {
            return;
        }
        if (m_itemBox == null)
        {
            return;
        }

        if (nIdx < 0 || nIdx >= m_equpmentIcons.Count)
        {
            return;
        }

        IEquipment equip = m_itemBox.OutPut(nIdx);

        if (equip is CWearable)
        {
            CWearable equipWear = equip as CWearable;

            CWearable inputWear = m_inventory.ChangeWearable(equipWear);
            m_itemBox.InputEquip(inputWear);
        }
        else if (equip is CWeapon)
        {
            CWeapon equipWeapon = equip as CWeapon;

            CWeapon inputWeapon = m_inventory.EquipWeapon(equipWeapon);
            m_itemBox.InputEquip(inputWeapon);
        }
    }
Exemplo n.º 9
0
    // ------------------------------

    void Awake()
    {
        weap = MonoBehaviour.FindObjectOfType(typeof(CWeapon)) as CWeapon;
        ship = MonoBehaviour.FindObjectOfType(typeof(CShip)) as CShip;
//		spr = MonoBehaviour.FindObjectOfType(typeof(CSpriteManager)) as CSpriteManager;

        this.paused = false;
    }
Exemplo n.º 10
0
 public void WeaponPickup(CWeapon weapon)
 {
     rof        = weapon.rof;
     lifetime   = weapon.lifetime;
     type       = weapon.type;
     projectile = weapon.projectile;
     bucket     = weapon.bucket;
 }
Exemplo n.º 11
0
    // ----------

    void OnCollisionEnter(Collision coll)
    {
        if (coll.gameObject.tag != this.tag)
        {
            if (goesUp)             // If it goes up, means that it was a user's shot
            {
                CWeapon.ReportHit();
            }

            DestroyMe();
        }
    }
Exemplo n.º 12
0
        private double GetArmorPierceThreat(CWeapon weapon)
        {
            double threat = weapon.GetStat(EWeaponStat.Armor_Pierce);

            if (threat > 0)
            {
                return(WeaponThreatTable.Instance.Table[EWeaponStat.Armor_Pierce] / threat);
            }
            else
            {
                return(0);
            }
        }
 public void SelectWeapon()
 {
     if (bIsOpened[currentGunIndex])
     {
         GameObject weaponObj = GameObject.Instantiate(CResourceManager.Instance.GetObjectForKey(gunList[currentGunIndex].gunPrefabPath),
                                                       CWeaponManager.Instance.weaponParent);
         CWeapon selectWeapon = weaponObj.GetComponent <CWeapon>();
         CWeaponManager.Instance.DestroyWeapon(0);
         CWeaponManager.Instance.AddWeapon(selectWeapon);
         ES3.Save <string>("BaseGun", selectWeapon.gunName, "Weapon.es3");
         this.gameObject.SetActive(false);
     }
 }
Exemplo n.º 14
0
 void InterruptAttacks()
 {
     for (int i = 0; i < m_ListWeaponsGO.Count; i++)
     {
         CWeapon weapon = m_ListWeaponsGO[m_iCurrentAttackIndex].GetComponent <CWeapon>();
         weapon.Initialize();
         weapon.DisableWeapon();
         m_ListWeaponsGO[m_iCurrentAttackIndex].gameObject.SetActive(false);
     }
     m_bIsAttacking = false;
     m_bCanAttack   = true;
     //additional stuff if need be
 }
Exemplo n.º 15
0
 public void RemoveWeapon(bool lWeapon)
 {
     if (lWeapon)
     {
         this._parent.GetStatMods().RemoveGearMods(this._lWeapon);
         this._lWeapon = null;
     }
     else
     {
         this._parent.GetStatMods().RemoveGearMods(this._rWeapon);
         this._rWeapon = null;
     }
 }
Exemplo n.º 16
0
 public void AddWeapon(E_WEAPON_TYPE type)
 {
     if (m_shipStats.weaponAttachement < m_shipStats.maxWeapons)
     {
         CWeapon weapon = new CWeapon(this, type);
         m_shipStats.weaponAttachement++;
         m_weaponList.Add(weapon);
     }
     else
     {
         Debug.Log("Add weapon impossible, ship can only have " +
                   m_shipStats.maxWeapons);
     }
 }
Exemplo n.º 17
0
    IEnumerator InitCoroutine()
    {
        SetPlayerGender(0);
        yield return(null);

        while (m_wearUnit.Inventory == null)
        {
            yield return(null);
        }

        CWeapon weapon = CDataManager.Inst.EquipmentContainer.GetEquipment(PartsType.WEAPON, m_nCurset) as CWeapon;

        m_wearUnit.Inventory.EquipWeapon(weapon);
    }
Exemplo n.º 18
0
        public double GetWeaponThreatPoints(CWeapon weapon)
        {
            double threat = 0;

            if (weapon != null)
            {
                threat += this.GetAccuracyThreat(weapon);
                threat += this.GetArmorIgnoreThreat(weapon);
                threat += this.GetArmorPierceThreat(weapon);
                threat += this.GetBlockIgnoreThreat(weapon);
                threat += this.GetDamageThreat(weapon);
                threat += this.GetShieldDamageThreat(weapon);
            }
            return(threat);
        }
Exemplo n.º 19
0
    public void OutPutEquipment(int nIdx)
    {
        if (!m_boxGO.activeSelf)
        {
            return;
        }

        if (nIdx >= (int)PartsType.MAX)
        {
            return;
        }

        if (m_inventory == null)
        {
            return;
        }

        PartsType type = (PartsType)nIdx;

        if (m_inventory.IsNoEquip(type))
        {
            return;
        }

        IEquipment naked = CDataManager.Inst.EquipmentContainer.GetEquipment(type, 0);

        if (type == PartsType.WEAPON)
        {
            CWeapon hand = naked as CWeapon;
            if (hand == null)
            {
                return;
            }
            CWeapon weapon = m_inventory.EquipWeapon(hand);
            m_itemBox.InputEquip(weapon);
        }
        else
        {
            CWearable zeroParts = CDataManager.Inst.EquipmentContainer.GetEquipment(type, 0) as CWearable;
            if (zeroParts == null)
            {
                return;
            }
            CWearable wearable = m_inventory.ChangeWearable(zeroParts);

            m_itemBox.InputEquip(wearable);
        }
    }
Exemplo n.º 20
0
 public static void SetCurrWeapon(int slot, int state)
 {
     if (SpecCam.show)
     {
         return;
     }
     if (slot < 0)
     {
         return;
     }
     if (BasePlayer.weapon[slot] == null)
     {
         return;
     }
     BasePlayer.currweapon = BasePlayer.weapon[slot];
     Client.cs.send_currweapon(BasePlayer.currweapon.data.wid, state);
 }
Exemplo n.º 21
0
        public override IInventoryItem Create(XElement itemData)
        {
            String idData = itemData.Attribute("id")?.Value ??
                            throw new Exception($"Attribute 'id' not found in {itemData.Value}");
            Guid   id   = Guid.Parse(idData);
            String name = itemData.Attribute("name")?.Value ??
                          throw new Exception($"Attribute 'name' not found in {itemData.Value}");
            String costData = itemData.Attribute("cost")?.Value ??
                              throw new Exception($"Attribute 'cost' not found in {itemData.Value}");
            Int32  cost       = Int32.Parse(costData);
            String damageData = itemData.Element("damage")?.Value ??
                                throw new Exception($"Element 'damage' not found in {itemData.Value}");
            Int32   damage = Int32.Parse(damageData);
            CWeapon weapon = CWeapon.Create(id, name, cost, damage);

            return(weapon);
        }
Exemplo n.º 22
0
 public void ComputeWeaponDamage(CShip target, CWeapon weapon)
 {
     //Shields first
     if (target.m_shipStats.shield > 0)
     {
         target.m_shipStats.shield -= weapon.m_weaponStats.m_shielDamage;
         if (target.m_shipStats.shield < 0)
         {
             target.m_shipStats.shield = 0;
         }
     }
     //if shields are off, shell can be damaged
     if (target.m_shipStats.shield <= 0 && target.m_shipStats.shell > 0)
     {
         target.m_shipStats.shell -= weapon.m_weaponStats.m_shellDamage;
     }
     target.CheckDestruction();
 }
Exemplo n.º 23
0
    public void AddWeapon(CWeapon weapon)
    {
        if (!IsFullInventory())
        {
            var AddWeapon = weapon;
            AddWeapon.transform.parent        = weaponParent;
            AddWeapon.transform.localPosition = currentWeapon.transform.localPosition;
            weaponList.Add(AddWeapon);
            if (bulletArray[weaponList.Count - 1] == -1)
            {
                bulletArray[weaponList.Count - 1] = weaponList[weaponList.Count - 1].GetMaxBullet();
            }

            weaponList[weaponList.Count - 1].SetCurrentBullet(bulletArray[weaponList.Count - 1]);
            this.SetCurrentWeapon(AddWeapon);
            //내 무기는 웨펀리스트 카운트 -1
            this.SaveWeapon();
        }
    }
Exemplo n.º 24
0
        public void UndoSpearWallFX(CChar source, CWeapon weapon, bool lWeapon)
        {
            var view = weapon.View;

            if (view.SpearWalling)
            {
                if (lWeapon)
                {
                    var wpnObject = source.SubComponents[SortingLayers.CHAR_L_WEAPON];
                    this.UndoSpearWallFXHelper(wpnObject, lWeapon);
                }
                else
                {
                    var wpnObject = source.SubComponents[SortingLayers.CHAR_R_WEAPON];
                    this.UndoSpearWallFXHelper(wpnObject, lWeapon);
                }
                view.SpearWalling = false;
            }
        }
Exemplo n.º 25
0
    void InitWeaponSlot(CDataManager dataMgr)
    {
        // TODO: PlayerData에서 설정 장비 가져오기

        int nWIdx = m_inventoryInfo.curWeaponIdx;

        CWeapon weapon = dataMgr.EquipmentContainer.GetEquipment(PartsType.WEAPON, nWIdx) as CWeapon;

        EquipWeapon(weapon);

        int nSecondWIdx = m_inventoryInfo.subWeaponIdx;

        CWeapon subWeapon = dataMgr.EquipmentContainer.GetEquipment(PartsType.WEAPON, nSecondWIdx) as CWeapon;

        if (subWeapon != null)
        {
            EquipWeapon(subWeapon, subWeapon.WaitSlot, true);
        }
    }
Exemplo n.º 26
0
    public void Init(CUnit unit, CWeapon weapon = null)
    {
        m_unit = unit;

        if (m_weapon == null)
        {
            if (weapon == null)
            {
                Debug.LogError("Weapon Data is null!");
                return;
            }
            m_weapon = weapon;
        }

        for (int i = 0; i < m_colliders.Count; i++)
        {
            m_colliders[i].Init(m_unit, m_weapon);
        }
    }
Exemplo n.º 27
0
    void WeaponSlotSetting(CWeaponHook weaponHook, SlotIdx slotIdx)
    {
        if (weaponHook == null)
        {
            return;
        }

        CWeapon weapon = weaponHook.Weapon;

        if (weapon == null)
        {
            return;
        }

        weaponHook.transform.parent = m_Slots[(int)slotIdx];

        weaponHook.gameObject.transform.localPosition = weapon.Prefab.transform.localPosition;
        weaponHook.gameObject.transform.localRotation = weapon.Prefab.transform.localRotation;
        weaponHook.gameObject.transform.localScale    = weapon.Prefab.transform.localScale;
    }
Exemplo n.º 28
0
    IEnumerator ChangeMainSubCoroutine()
    {
        CWeapon tempWeapon = m_mainEquip;

        m_mainEquip = m_subEquip;
        m_subEquip  = tempWeapon;

        CWeaponHook tempHook = MainHook;

        m_MainHook = SubHook;
        m_subHook  = tempHook;

        m_actionCtrl.Anim.SetInteger("WeaponIdx", (int)m_mainEquip.WeaponType);

        yield return(new WaitForSeconds(0.5f));

        WeaponSlotSetting(m_MainHook, SlotIdx.Right);
        WeaponSlotSetting(m_subHook, m_subHook.Weapon.WaitSlot);

        yield return(null);
    }
Exemplo n.º 29
0
    public void SetPlayerFirstSet(int nSetIdx)
    {
        if (m_wearUnit.Inventory == null)
        {
            return;
        }

        m_nCurset = nSetIdx;
        m_nNotset = m_nCurset == 1 ? 2 : 1;

        //nSetIdx += m_playerInfo.gender == Gender.Male ? 100 : 0;

        CWearable[] wearables = new CWearable[(int)PartsType.WEAPON];

        for (int i = 0; i < (int)PartsType.WEAPON; i++)
        {
            wearables[i] = CDataManager.Inst.EquipmentContainer.GetEquipment((PartsType)i, nSetIdx) as CWearable;
            m_wearUnit.Inventory.ChangeWearable(wearables[i]);
        }

        CWeapon weapon = CDataManager.Inst.EquipmentContainer.GetEquipment(PartsType.WEAPON, 1) as CWeapon;

        m_wearUnit.Inventory.EquipWeapon(weapon);
    }
Exemplo n.º 30
0
    // ------------------------------
    void Awake()
    {
        weap = MonoBehaviour.FindObjectOfType(typeof(CWeapon)) as CWeapon;
        ship = MonoBehaviour.FindObjectOfType(typeof(CShip)) as CShip;
        //		spr = MonoBehaviour.FindObjectOfType(typeof(CSpriteManager)) as CSpriteManager;

        this.paused = false;
    }
Exemplo n.º 31
0
        private void PredictAbilitiesHelper(MTile tile, MAbility ability, bool lWeapon, CWeapon parentWeapon, bool wpnAbility)
        {
            var target     = tile.GetCurrentOccupant() as CChar;
            var prediction = new AgentAbilityData();

            prediction.Ability      = ability;
            prediction.LWeapon      = lWeapon;
            prediction.ParentWeapon = parentWeapon;
            prediction.Target       = target;
            prediction.Weight       = 0;
            prediction.WpnAbiltiy   = wpnAbility;
            if (ability.Data.Hostile)
            {
                if (target.Proxy.LParty != this._agent.Proxy.LParty)
                {
                    this.HandleAbility(prediction);
                    this._predictions.Add(prediction);
                }
            }
            else
            {
                if (target.Proxy.LParty == this._agent.Proxy.LParty)
                {
                    this.HandleAbility(prediction);
                    this._predictions.Add(prediction);
                }
            }
        }