Beispiel #1
0
    void WeaponAction(GameObject Object)
    {
        // DropItemを取得
        var DIScript = Object.GetComponent <DropGun>();

        // 落ちている武器を装備する
        // ※DropWeaponには持ってた武器
        DropWeapon = CEScript.GetWeapon(Object);

        // 武器交換の場合、生成する
        if (DropWeapon != null)
        {
            // ※getWeaponには手に入れる武器
            GameObject getWeapon = Instantiate <GameObject>(Object);
            getWeapon.name = DIScript.WeaponInfo.name;

            // 武器情報の交換
            GunInfo       getGIScript  = getWeapon.GetComponent <GunInfo>();
            GunController dropGCScript = DropWeapon.GetComponent <GunController>();

            // 落ちている武器を削除
            Destroy(Object.gameObject);

            // 持ってた武器の情報を保持
            var RankInfo           = dropGCScript.gunRank;           // 武器ランク
            var TypeInfo           = dropGCScript.gunType;           // 武器種類
            var SlotInfo           = dropGCScript.skillSlot;         // スキルスロット数
            var MaxMagazineInfo    = dropGCScript.MagazineSize;      // 1マガジンのサイズ
            var remMagazineInfo    = dropGCScript.Ammo;              // マガジン内の残弾数
            var MaxAmmoInfo        = dropGCScript.AmmoSize;          // 予備弾数サイズ
            var remAmmoInfo        = dropGCScript.remAmmo;           // 予備弾数
            var DamageInfo         = dropGCScript.Damage;            // 火力
            var shootIntervalInfo  = dropGCScript.shootInterval;     // 射撃間隔
            var reloadIntervalInfo = dropGCScript.reloadInterval;    // リロードスピード
            var PowerInfo          = dropGCScript.bulletPower;       // 弾の飛ばす力
            var EXPInfo            = dropGCScript.GunEXP;            // 銃の経験値

            // 落とす武器に情報を入れる(dropGCScript <= getGIScript)
            CEScript.ChangeGunConInfo(dropGCScript, getGIScript, 1);

            // 拾う武器に情報を入れる
            getGIScript.gunRank        = RankInfo;
            getGIScript.gunType        = TypeInfo;
            getGIScript.skillSlot      = SlotInfo;
            getGIScript.MagazineSize   = MaxMagazineInfo;
            getGIScript.remMagazine    = remMagazineInfo;
            getGIScript.ammoMax        = MaxAmmoInfo;
            getGIScript.remAmmo        = remAmmoInfo;
            getGIScript.Damage         = DamageInfo;
            getGIScript.shootInterval  = shootIntervalInfo;
            getGIScript.reloadInterval = reloadIntervalInfo;
            getGIScript.bulletPower    = PowerInfo;
            getGIScript.GunEXP         = EXPInfo;
        }
        else
        {
            // 落ちている武器を削除
            Destroy(Object.gameObject);
        }
    }
Beispiel #2
0
 /*
  * INITIALIZATION
  */
 public void Start()
 {
     gunInfoDAO         = new GunDAO();    // TODO: Consider using service locator pattern
     stats              = gunInfoDAO.GetGunInfoByName("The Gun");
     myTransform        = GetComponent <Transform>();
     firePointTransform = myTransform.FindChild("FirePoint");
 }
Beispiel #3
0
    public void SelectGun(GunInfo info)
    {
        bool unlocked = player.unlockedGuns.Contains(info);


        if (unlocked)
        {
            var g = Instantiate(gunDataBase.GetById(info.item_id));
            if (player.itemInHand)
            {
                g.transform.position = player.transform.position;
            }
            else
            {
                player.item       = g;
                player.itemInHand = true;
                if (g.GetComponent <GunInfo>().weaponClass == WeaponClass.SniperRiffle)
                {
                    g.GetComponent <Sniper>().isOnPlayerHand = true;
                }
            }


            CloseShop();
        }
    }
Beispiel #4
0
    public void UpdateUI()
    {
        GunInfo info     = IOHelper.GetGunInfoById((int)type);
        int     level    = WeaponDB.Instance.GetWeaponLvById((int)type);
        int     tmpLevel = Mathf.Max(1, level);

        Debug.Log("tmpLevel " + tmpLevel + " (int)wt " + (int)type);
        GunUpgradeInfo upgradeInfo     = IOHelper.GetGunUpgradeInfoByIdAndLevel((int)type, tmpLevel);
        GunUpgradeInfo nextUpgradeInfo = IOHelper.GetGunUpgradeInfoByIdAndLevel((int)type, level + 1);
        GunUpgradeInfo maxInfo         = IOHelper.GetGunUpgradeInfoByIdAndLevel((int)type, info.maxlv);


        if (level < info.maxlv)
        {
            lv.SetActive(true);
            maxLv.SetActive(false);
            labelCurrentLevel.text = tmpLevel.ToString();
        }
        else
        {
            lv.SetActive(false);
            maxLv.SetActive(true);
        }
        labelCurrentAttack.text   = upgradeInfo.atk.ToString();
        labelCurrentCapacity.text = upgradeInfo.capacity.ToString();
        labelSpeed.text           = info.speed.ToString();

        progressAttack.value   = (float)upgradeInfo.atk / (float)maxInfo.atk;
        progressCapacity.value = (float)upgradeInfo.capacity / (float)maxInfo.capacity;
    }
Beispiel #5
0
    void Start()
    {
        boxTrans = this.transform;

        GIScript = ItemPrefab.GetComponent <GunInfo>();

        // 中身の抽選
        random =  UnityEngine.Random.Range(0, 6);
    }
Beispiel #6
0
        void UpdateAmmo(GunInfo gunInfo)
        {
            var hudEntityViews = entityViewsDB.QueryEntityViews <HUDEntityView>();

            for (int i = 0; i < hudEntityViews.Count; i++)
            {
                hudEntityViews[i].bulletCountComponent.magazineCount = gunInfo.magazineCapacity;
                hudEntityViews[i].bulletCountComponent.currentCount  = gunInfo.currentBulletCount;
            }
        }
Beispiel #7
0
 public override void SwapWeapon()
 {
     if (stats.Name == "The Gun")
     {
         stats = gunInfoDAO.GetGunInfoByName("The Faster Gun");
     }
     else
     {
         stats = gunInfoDAO.GetGunInfoByName("The Gun");
     }
 }
Beispiel #8
0
    public void EquipGun(int Index)
    {
        int Role     = GetComponent <MainCharacter>().ID;
        int gunindex = Game.Instance.StaticData.People[Role].EquipGunId[Index];


        GunInfo gun  = Game.Instance.StaticData.GetGunInfo(gunindex);
        string  path = "Prefabs/Guns/" + gun.PrefabName;

        CreatGun(gun.GunType, path);
    }
Beispiel #9
0
    public void AcquireGun(int _level)
    {
        player = gameObject.GetComponentInParent <PlayerCombatController>();
        GunInfo info = GunManager._instance.getGunData(type);

        damage       = info.damage[_level - 1];
        range        = info.range[_level - 1];
        reloadSpeed  = info.reloadSpeed[_level - 1];
        magazineSize = info.magazineSize[_level - 1];
        fireRate     = info.fireRate[_level - 1];
        level        = _level;
    }
Beispiel #10
0
    public void OnUpgrade()
    {
        GunInfo info = IOHelper.GetGunInfoById((int)currentWeaponType);

        int level = WeaponDB.Instance.GetWeaponLvById((int)currentWeaponType);

        if (level >= info.maxlv)
        {
            return;
        }

        GunUpgradeInfo nextUpgradeInfo = IOHelper.GetGunUpgradeInfoByIdAndLevel((int)currentWeaponType, level + 1);

        if (nextUpgradeInfo.type == 1 && nextUpgradeInfo.cost <= GameData.Instance.currentGold)
        {
            SettingManager.Instance.WeaponUpgrade += 1;
            GameData.Instance.AddGold(-nextUpgradeInfo.cost);
            WeaponDB.Instance.UpdateWeapon((int)currentWeaponType, level + 1);
            SettingManager.Instance.MaxWeaponLevel = Mathf.Max(level + 1, SettingManager.Instance.MaxWeaponLevel);
            UpdateUI(currentWeaponType);
            MTAUpgradePoint();
            GameObject effect = (GameObject)Instantiate(upgradeEffectPrefab);
            effect.transform.parent        = GameObject.FindGameObjectWithTag("3DWeapon").transform;
            effect.transform.localPosition = new Vector3(0, -1.5f, 0);
            StartCoroutine(FireTrigger());
        }
        else if (nextUpgradeInfo.type == 2 && nextUpgradeInfo.cost <= GameData.Instance.currentDiamond)
        {
            SettingManager.Instance.MaxWeaponLevel = Mathf.Max(level + 1, SettingManager.Instance.MaxWeaponLevel);
            SettingManager.Instance.WeaponUpgrade += 1;
            GameData.Instance.AddDiamond(-nextUpgradeInfo.cost);
            WeaponDB.Instance.UpdateWeapon((int)currentWeaponType, level + 1);
            UpdateUI(currentWeaponType);
            MTAUpgradePoint();
            GameObject effect = (GameObject)Instantiate(upgradeEffectPrefab);
            effect.transform.parent        = GameObject.FindGameObjectWithTag("3DWeapon").transform;
            effect.transform.localPosition = new Vector3(0, -1.5f, 0);
            StartCoroutine(FireTrigger());
        }
        else
        {
            if (nextUpgradeInfo.type == 1)
            {
                NotEnoughGoldDialog.Popup();
            }
            else if (nextUpgradeInfo.type == 2)
            {
                NotEnoughDiamondDialog.Popup();
            }
            Debug.LogWarning("resource is not enough!");
        }
    }
Beispiel #11
0
        public GunInfo GetGunInfo(ulong uid, int bone)
        {
            var info = new GunInfo
            {
                GunId        = uid,
                GunTypeId    = typeId,
                StockBullets = stock,
                Interval     = IntervalCheckerInitializer.InitializedChecker(inter),
                AttachedBone = bone,
            };

            return(info);
        }
    public bool CompareGun(GunInfo newInfo)
    {
        if (equippedGun == null)
        {
            return(false);
        }
        else if (equippedGunInfo.GunName == newInfo.GunName)
        {
            return(true);
        }

        return(false);
    }
Beispiel #13
0
 public Gun(PhysicalObject par, GunInfo gunInfo, BaseProjectilesController pController, int team, bool active)
 {
     parent                = par;
     isActive              = active;
     projectileSpeed       = gunInfo.projectileSpeed;
     shootTime             = 1f / gunInfo.shootRate;
     projectilesType       = gunInfo.projectilesType;
     shootStartPositions   = gunInfo.shootPositions;
     damage                = gunInfo.damage;
     timeToShoot           = 0f;
     positionIndex         = 0;
     IsShooting            = false;
     projectilesController = pController;
     this.team             = team;
 }
Beispiel #14
0
    public void SwitchSecondary(GameObject components, Gun controller)
    {
        GunInfo temp;

        temp.gunComponents = components;
        temp.gunController = controller;

        secondary = temp;

        if (equipped == 0 || equipped == 2)
        {
            equipped = 2;
            SwapWeapon(equipped);
        }
    }
Beispiel #15
0
    public void SwitchPrimary(GameObject components, Gun controller)
    {
        GunInfo temp;

        temp.gunComponents = components;
        temp.gunController = controller;

        primary = temp;

        if (equipped == 0 || equipped == 1)
        {
            equipped = 1;
            SwapWeapon(equipped);
        }
    }
Beispiel #16
0
    public void UpdateSecondary(int gunNum)
    {
        int index;

        index = SearchInventory(gunNum);

        if (index != -1)
        {
            if (secondary.gunController != null)
            {
                gunsInInventory.Add(secondary);
            }

            secondary = gunsInInventory[index];
            gunsInInventory.Remove(gunsInInventory[index]);

            if (GM == null)
            {
                GM = transform.Find("/PhotonPlayer(Clone)").gameObject.GetComponent <GunManager>();
            }
            if (GM != null)
            {
                GM.SwitchSecondary(secondary.gunComponents, secondary.gunController);
                UpdateInventory();

                Debug.Log(secondary.gunController.Id);

                if (gunImages[secondary.gunController.Id] == null)
                {
                    Debug.Log("[ERROR] Could not find image in list.");
                }

                secondaryImage.sprite = gunImages[secondary.gunController.Id];
                secondaryImage.color  = new Vector4(1.0f, 1.0f, 1.0f, 1.0f);
                secondaryText.text    = secondary.gunController.Name;

                Debug.Log("[INFO] Primary weapon changed.");
            }
            else
            {
                Debug.Log("[ERROR] Gun manager not retrieved.");
            }
        }
        else
        {
            Debug.Log("[ERROR] Could not find gun in list.");
        }
    }
Beispiel #17
0
    private void CreateGun()
    {
        Debug.Log("CreateGun");
        int     gunLength = DataMng.Instance.TableLength(TableType.GunTable);
        int     gunIdx    = Random.Range(0, 13);
        GunInfo gunInfo   = DataMng.Instance.Table(TableType.GunTable, gunIdx) as GunInfo;
        Gun     gun       = Instantiate(Resources.Load <Gun>(Path + gunInfo.NAME), transform.position, Quaternion.identity);

        gun.Init(gunInfo);

        ItemInfo info = DataMng.Instance.Table(TableType.ItemTable, gunInfo.NAME) as ItemInfo;

        gun.GetComponent <Item>().SetItem(info);

        gun.enabled = false;
    }
        public GunInfo GetGunInfo(ulong uid)
        {
            var info = new GunInfo
            {
                GunId           = uid,
                GunTypeId       = typeId,
                StockBullets    = stock,
                StockMax        = stock,
                AttackRange     = atkRange,
                AttackAngle     = atkAngle,
                Interval        = IntervalCheckerInitializer.InitializedChecker(inter),
                AttachedPosture = attached,
            };

            return(info);
        }
Beispiel #19
0
    public GunData(GunInfo gunInfo)
    {
        Name   = gunInfo.Name;
        Avatar = gunInfo.Avatar;

        Damage     = new Statistic(gunInfo.Damage);
        FireRate   = new Statistic(gunInfo.FireRate);
        ReloadTime = new Statistic(gunInfo.ReloadTime);
        Magazine   = new Statistic(gunInfo.Magazine);

        BulletSpeed = gunInfo.BulletSpeed;
        Autiomatic  = gunInfo.Automatic;

        Price    = gunInfo.Price;
        IsBought = Price <= 0;
    }
Beispiel #20
0
    private void DrawSelectPlayerInfo()
    {
        float shotSpeed = 0;

        _charInfo = DataMng.Instance.Table(TableType.CharTable, _selectPlayer.name) as CharInfo;
        _gunInfo  = DataMng.Instance.Table(TableType.GunTable, _charInfo.STARTGUN) as GunInfo;

        _nameText.text      = _charInfo.UINAME;
        _lifeText.text      = _charInfo.HEALTH.ToString();
        _hungryText.text    = _charInfo.HUNGRY.ToString();
        _speedText.text     = _charInfo.SPEED.ToString();
        _gunName.text       = _charInfo.STARTGUN;
        _gunImage.sprite    = Resources.Load <Sprite>("Image/Guns/" + _charInfo.STARTGUN);
        shotSpeed           = _gunInfo.SHOOTSPEED * 10;
        _selectGunInfo.text = "Damage : " + _gunInfo.DAMAGE.ToString() + "\r\n" + "Power : " + _gunInfo.POWER.ToString() + "\r\n" + "Speed : " + shotSpeed.ToString();
        _description.text   = _charInfo.LORE;
    }
Beispiel #21
0
    public GunInfo GetGunInfoByName(string nameGun)
    {
        List <GunInfo> guns   = repoGuns.Contents;
        GunInfo        output = new GunInfo();

        foreach (GunInfo gun in guns)
        {
            if (gun.Name == nameGun)
            {
                output = gun;
                break;
            }
        }

        // TODO: Throw an error instead of return null
        return(output);
    }
Beispiel #22
0
    public void ShowGunInfo(int whichGun)
    {
        GunInfo gun = guns[whichGun].GetComponent <GunInfo>();

        numberInfo[0].text = gun.damage.ToString();
        numberInfo[1].text = gun.bulletsCapacity.ToString();
        numberInfo[2].text = gun.fireRate.ToString();
        numberInfo[3].text = (gun.reloadTime * 20).ToString();

        barInfo[0].fillAmount = gun.damage / 100;
        barInfo[1].fillAmount = gun.bulletsCapacity / 100;
        barInfo[2].fillAmount = gun.fireRate / 100;
        barInfo[3].fillAmount = (gun.reloadTime * 20) / 100;

        gunIcon.overrideSprite = gunsImages[whichGun];
        gunInfoPanel.SetActive(true);
    }
Beispiel #23
0
    public void Initialize()
    {
        Hp   = maxHp;
        Mana = maxMana;

        entityState = EntityState.ALIVE;

        gunInfo = GameManager.instance.DataBase.gunInfos[gunIndex];

        if (PlayerController.instance.player)
        {
            OnSetPlayer();
        }
        else
        {
            GameManager.instance.onSetPlayer += OnSetPlayer;
        }
    }
Beispiel #24
0
    public void DrawGunInfo(Gun gun)
    {
        GunInfo info  = DataMng.Instance.Table(TableType.GunTable, gun.GetComponent <Item>()._name) as GunInfo;
        int     speed = (int)(info.SHOOTSPEED * 10);

        _selectGunImage.color  = Color.white;
        _selectGunImage.sprite = gun.GetComponent <Item>()._sprite;
        _damage.text           = info.POWER.ToString();
        _power.text            = info.DAMAGE.ToString();
        _speed.text            = speed.ToString();

        int falseSpeed = (int)(gun.AddSpeed * 10);

        _damageUp.text = "(+" + gun.AddDamage.ToString() + ")";
        _powerUp.text  = "(+" + gun.AddSpeed.ToString() + ")";
        _speedUp.text  = "(+" + falseSpeed.ToString() + ")";

        _itemName.text = info.NAME;
    }
Beispiel #25
0
    //private void FixedUpdate()
    //{
    //    //_equipedGun.transform.Rotate(_weaponPos.localEulerAngles);
    //}

    private void StartGun(string path)
    {
        _startGun = Resources.Load <Gun>("Prefab/Guns/PlayerGuns/" + path);
        _startGun = Instantiate(_startGun, _weaponPos.position, Quaternion.identity);
        _startGun.transform.parent = _weaponPos;

        GunInfo gunInfo = DataMng.Instance.Table(TableType.GunTable, path) as GunInfo;

        _startGun.Init(gunInfo);
        ItemInfo itemInfo = DataMng.Instance.Table(TableType.ItemTable, gunInfo.NAME) as ItemInfo;

        _startGun._item.SetItem(itemInfo);

        _gunDic.Add(_startGun._item._uniqueID, _startGun);
        _equipedGun = _startGun;

        UIMng.Instance.CallEvent(UIList.Inventory, "AddItem", _startGun.GetComponent <Item>());

        GunUIChange(_startGun);
    }
Beispiel #26
0
        public override void Awake()
        {
            weaponType = WeaponType.Gun;
            if (weaponData == null)
            {
                weaponData = new GunInfo(weaponName, 10000, 25, 5);
            }
            else
            {
                throw new Exception("WeaponInfo is not the type of GunInfo.");
            }

            WeaponSkill = new WeaponSkillDetail.Builder(SkillType.WpBurst, 0).SetColdDownTime(0).Build();

            if (soundFxAtk == null || soundFxAtk.Equals(""))
            {
                soundFxAtk = "shot_gun_shoot";
            }

            base.Awake();
        }
Beispiel #27
0
 private void SwapWeapon(int weapon)
 {
     if (activeGun.gunController != null)
     {
         activeGun.gunComponents.SetActive(false);
     }
     if (weapon == 1)
     {
         activeGun = primary;
         activeGun.gunComponents.SetActive(true);
         equippedGun         = activeGun.gunController;
         m_bulletsLeftInClip = equippedGun.ClipSize;
     }
     else if (weapon == 2)
     {
         activeGun = secondary;
         activeGun.gunComponents.SetActive(true);
         equippedGun         = activeGun.gunController;
         m_bulletsLeftInClip = equippedGun.ClipSize;
     }
 }
Beispiel #28
0
 public void BuyGuns(int whichGun)
 {
     if (!PV.IsMine)
     {
         return;
     }
     if (myGun == null)
     {
         PV.RPC("RPC_BuyGun", RpcTarget.AllBuffered, whichGun, PV.ViewID);
         myGunInfo    = myGun.GetComponent <GunInfo>();
         myGunVisible = Instantiate(allGuns[whichGun], myGunLocal.transform.position, transform.rotation, myGunLocal);
     }
     else
     {
         Destroy(myGunVisible);
         PV.RPC("RPC_BuyGun", RpcTarget.AllBuffered, whichGun, PV.ViewID);
         myGunInfo    = myGun.GetComponent <GunInfo>();
         myGunVisible = Instantiate(allGuns[whichGun], myGunLocal.transform.position, transform.rotation, myGunLocal);
     }
     myGun.SetActive(false);
 }
Beispiel #29
0
        public DynamicVehicleStats(ListVehicleProfile profile, StaticVehicleStats staticStats)
        {
            List <int> ids = profile.profile_id.Split('-').Select(i => Convert.ToInt32(i)).ToList();

            ids.Remove(staticStats.EngineID);
            ids.Remove(staticStats.SuspensionID);
            int gunID = ids.First(i => staticStats.Guns.Contains(i));

            ids.Remove(gunID);
            int turretID = ids.Single();

            ids = null;

            Gun                  = new GunInfo(profile.gun, gunID);
            Turret               = new TurretInfo(profile.turret, turretID);
            AmmoCapacity         = profile.max_ammo;
            HP                   = Turret.HP + staticStats.BaseHP;
            Weight               = staticStats.BaseWeight + Gun.Weight + Turret.Weight;
            TraverseSpeed        = staticStats.BaseTraverse * (staticStats.StockWeight / Weight);
            Weight              /= 1000;
            HorsePowerToTonRatio = staticStats.HorsePower / Weight;
        }
Beispiel #30
0
        /// <summary>
        /// 初始化武器
        /// </summary>
        public override void Awake()
        {
            weaponType = WeaponType.Gun;
            if (!(weaponData is GunInfo))
            {
                weaponData = new GunInfo(weaponName, 100);
            }
            else
            {
                throw new Exception("WeaponInfo is not the type of GunInfo.");
            }

            WeaponSkill = new WeaponSkillDetail.Builder(SkillType.WpNone, 0).Build();


            if (soundFxAtk == null || soundFxAtk.Equals(""))
            {
                soundFxAtk = "rifle_shoot";
            }

            base.Awake();
        }