コード例 #1
0
ファイル: WeaponManager.cs プロジェクト: rkdrnf/fortresswar
    public WeaponInfo ChangeWeapon(KeyCode code)
    {
        EndCharge();

            int index;

            switch (code)
            {
                case KeyCode.Alpha1:
                    index = 0;
                    break;

                case KeyCode.Alpha2:
                    index = 1;
                    break;

                case KeyCode.Alpha3:
                    index = 2;
                    break;

                case KeyCode.Alpha4:
                    index = 3;
                    break;

                default:
                    index = -1;
                    break;
            }

            if (indexTypeDic.ContainsKey(index))
                currentWeapon = weapons[indexTypeDic[index]];

            return currentWeapon;
    }
コード例 #2
0
 public override WeaponInfo ToInfo()
 {
     WeaponInfo info = new WeaponInfo( weaponType, modifier );
     info.AddAttribute( "Damage", RoundStatToDecimalPlaces( damage, 1 ) + "/s" );
     info.AddAttribute( "Range", RoundStatToDecimalPlaces( beamRange, 1 ).ToString() );
     return info;
 }
コード例 #3
0
    public override WeaponInfo ToInfo( WeaponModifier.ModifierNames mod )
    {
        float moddedDamage = damage * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.DAMAGE );
        float moddedFireRate = fireTime / WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.FIRE_RATE );
        float moddedAccuracy = maxSpreadAngle / WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.ACCURACY );

        WeaponInfo info = new WeaponInfo( weaponType, mod );

        if( weaponType != WeaponType.SCATTER_SHOT )
        {
            info.AddAttribute( "Damage", RoundStatToDecimalPlaces( moddedDamage, 1 ).ToString() );
        }
        else
        {
            int bonusProjectiles = (int)WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.BONUS_PROJECTILES );
            int count = projectilesPerShot + bonusProjectiles;
            info.AddAttribute( "Damage", RoundStatToDecimalPlaces( damage, 1 ) + " (x" + count + ")" );
        }

        info.AddAttribute( "Fire Rate", RoundStatToDecimalPlaces( 1 / moddedFireRate, 1 ) + "/s" );
        info.AddAttribute( "Projectile Speed", RoundStatToDecimalPlaces( projectileSpeed, 1 ).ToString() );
        info.AddAttribute( "Accuracy", RoundStatToDecimalPlaces( ( 1 - ( moddedAccuracy * 2 / 180 ) ) * 100, 1 ) + "%" );

        return info;
    }
コード例 #4
0
    public override WeaponInfo ToInfo( WeaponModifier.ModifierNames mod )
    {
        if (weaponType == WeaponType.MISSILE_LAUNCHER)
        {
            SetCost(100);
        }
        float moddedDamage = damage * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.DAMAGE );
        float moddedFireRate = fireTime / WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.FIRE_RATE );
        float moddedAccuracy = maxSpreadAngle / WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.ACCURACY );
        float moddedCost = cost * WeaponModifier.GetModifierValue(mod, WeaponModifier.Stats.COST_MOD);
        SetCost((int)moddedCost);

        WeaponInfo info = new WeaponInfo( weaponType, mod );

        if( weaponType != WeaponType.SCATTER_SHOT )
        {
            info.AddAttribute( "Damage", RoundStatToDecimalPlaces( moddedDamage, 1 ).ToString() );
        }

        else
        {
            float bonusProjectiles = WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.BONUS_PROJECTILES );
            int count = Mathf.CeilToInt( projectilesPerShot * bonusProjectiles );
            info.AddAttribute( "Damage", RoundStatToDecimalPlaces( damage, 1 ) + " (x" + count + ")" );
        }

        info.AddAttribute( "Fire Rate", RoundStatToDecimalPlaces( 1 / moddedFireRate, 1 ) + "/s" );
        info.AddAttribute( "Projectile Speed", RoundStatToDecimalPlaces( projectileSpeed, 1 ).ToString() );
        info.AddAttribute( "Accuracy", RoundStatToDecimalPlaces( ( 1 - ( moddedAccuracy * 2 / 180 ) ) * 100, 1 ) + "%" );
        info.AddAttribute("Cost", RoundStatToDecimalPlaces(moddedCost, 1).ToString());

        return info;
    }
コード例 #5
0
ファイル: Weapon.cs プロジェクト: andy-uq/Echo
 private static Weapon Build(ulong id, WeaponInfo weaponInfo)
 {
     return new Weapon
     {
         Id = id,
         WeaponInfo = weaponInfo,
     };
 }
コード例 #6
0
 public override WeaponInfo ToInfo()
 {
     WeaponInfo info = new WeaponInfo( weaponType, modifier );
     info.AddAttribute( "Damage", RoundStatToDecimalPlaces( damage, 1 ).ToString() );
     info.AddAttribute( "Fire Rate", RoundStatToDecimalPlaces( 1 / fireTime, 1 ) + "/s" );
     info.AddAttribute( "Projectile Speed", RoundStatToDecimalPlaces( projectileSpeed, 1 ).ToString() );
     return info;
 }
コード例 #7
0
ファイル: WeaponManager.cs プロジェクト: rkdrnf/fortresswar
    public WeaponInfo ChangeWeapon(WeaponType type)
    {
        currentWeapon.isCharging = false;

            currentWeapon = weapons[type];

            return currentWeapon;
    }
コード例 #8
0
 public override WeaponInfo ToInfo( WeaponModifier.ModifierNames mod )
 {
     float moddedDamage = damage * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.DAMAGE );
     float moddedRange = beamRange * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.BEAM_RANGE );
     WeaponInfo info = new WeaponInfo( weaponType, mod );
     info.AddAttribute( "Damage", RoundStatToDecimalPlaces( moddedDamage, 1 ) + "/s" );
     info.AddAttribute( "Range", RoundStatToDecimalPlaces( moddedRange, 1 ).ToString() );
     return info;
 }
コード例 #9
0
    public override WeaponInfo ToInfo( WeaponModifier.ModifierNames mod )
    {
        float moddedDamage = damage * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.DAMAGE );
        float moddedSpeed = projectileSpeed * WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.MINE_SPEED );
        float moddedFireRate = fireTime / WeaponModifier.GetModifierValue( mod, WeaponModifier.Stats.FIRE_RATE );

        WeaponInfo info = new WeaponInfo( weaponType, mod );
        info.AddAttribute( "Damage", RoundStatToDecimalPlaces( moddedDamage, 1 ).ToString() );
        info.AddAttribute( "Fire Rate", RoundStatToDecimalPlaces(  1 / moddedFireRate, 1 ) + "/s" );
        info.AddAttribute( "Projectile Speed", RoundStatToDecimalPlaces( moddedSpeed, 1 ).ToString() );
        return info;
    }
コード例 #10
0
    void Update()
    {
        ShootController();

        if (Arma == 0)
        {
            CurrentWeapon = WeaponList[0];
        }

        if (Arma == 1)
        {
            CurrentWeapon = WeaponList[1];
        }
    }
コード例 #11
0
    //, Vector3 point)
    public void TakeDamage(float damage, GameObject hitby, WeaponInfo.EffectTypes damagetype)
    {
        this.health -= damage;
        //animation_component.wrapMode = WrapMode.Once;
           // animation_component.Play("gethit");

        if (NearestPlayer == null)
        {
            SetPlayerToAttack(hitby);
        }

        GameObject text = (GameObject)GameObject.Instantiate(damage_text, transform.position, new Quaternion(0, 0, 0, 0));
        TextMesh textmesh = text.GetComponent<TextMesh>();
        textmesh.text = damage.ToString();
        text.transform.Translate(new Vector3(0, 2, 0));
        text.transform.forward = Camera.main.transform.forward;

        switch (damagetype)
        {
            case (WeaponInfo.EffectTypes.FIRE):
            {
                textmesh.color = Color.red;
                break;
            }
            case (WeaponInfo.EffectTypes.LIGHTNING):
            {
                textmesh.color = Color.magenta;
                break;
            }
            case (WeaponInfo.EffectTypes.ICE):
            {
                textmesh.color = Color.blue;
                break;
            }
            default:
            {
                textmesh.color = Color.white;
                break;
            }
        }

        if (this.health <= 0 && !animation_component.IsPlaying("die"))
        {
            agent.speed = 0;
            animation_component.wrapMode = WrapMode.Once;
            animation_component.Play("die");
            Destroy(this.gameObject, 2.0f);
            DropItem();
        }
    }
コード例 #12
0
        private void lsGundam_SelectedIndexChanged(object sender, EventArgs e)
        {
            WeaponInfo master = lsGundam.SelectedItem as WeaponInfo;

            if (master != null)
            {
                LoadData(master);
            }
            else
            {
                LoadData(null);
            }
            tsmiLblState.Text      = "等待修改";
            tsmiLblState.ForeColor = Color.Black;
        }
コード例 #13
0
ファイル: PeriodicExplosion.cs プロジェクト: m-ober/CAmod
        public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            base.RulesetLoaded(rules, ai);

            WeaponInfo weaponInfo;

            var weaponToLower = Weapon.ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out weaponInfo))
            {
                throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(weaponToLower));
            }

            WeaponInfo = weaponInfo;
        }
コード例 #14
0
        public SwallowActor(Actor self, Target target, WeaponInfo weapon)
        {
            this.target    = target;
            this.weapon    = weapon;
            sandworm       = self.Trait <Sandworm>();
            positionable   = self.Trait <Mobile>();
            swallow        = self.Trait <AttackSwallow>();
            withSpriteBody = self.Trait <WithSpriteBody>();
            radarPings     = self.World.WorldActor.TraitOrDefault <RadarPings>();
            countdown      = swallow.Info.AttackTime;

            withSpriteBody.DefaultAnimation.ReplaceAnim(sandworm.Info.BurrowedSequence);
            stance   = AttackState.Burrowed;
            location = target.Actor.Location;
        }
コード例 #15
0
ファイル: Oilpatch.cs プロジェクト: jkalmar/OpenKrush
        public void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            if (string.IsNullOrEmpty(Weapon))
            {
                return;
            }

            WeaponInfo weapon;
            var        weaponToLower = Weapon.ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out weapon))
            {
                throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(weaponToLower));
            }
            WeaponInfo = weapon;
        }
コード例 #16
0
//SWITCHING TO SHOTGUN
    IEnumerator SwapRifle()
    {
        WeaponList[0].weaponTransform.position = axeHolster.transform.position;
        WeaponList[0].weaponTransform.rotation = axeHolster.transform.rotation;
        WeaponList[0].weaponTransform.parent   = axeHolster;
        _animator.SetBool("SwapShotGun", true);
        currentWeapon = WeaponList[1];
        yield return(new WaitForSeconds(0.5f));

        usingAxe   = false;
        usingRifle = true;
        WeaponList[1].weaponTransform.position = shotgunHandPosition.transform.position;
        WeaponList[1].weaponTransform.rotation = shotgunHandPosition.transform.rotation;
        WeaponList[1].weaponTransform.parent   = shotgunHandPosition.transform;
        _animator.SetBool("SwapShotGun", false);
    }
コード例 #17
0
    void WeaponMaker()
    {
        Weaponlist = new List <WeaponInfo> ();
        Weaponset  = new WeaponInfo(5, 5, 5, 10, 2, "", "Wuddy Sword", true, "", 0, WeaponBases.Find(x => x.name == "Sword"), 10, 10, 10, 0);


//
//		Weaponset.Damage = 10;
//      //  Weaponset.MatType = MatType.Find(x=>x.Name== "Wuud");
//		Weaponset.Weight = 1;
//		Weaponset.Range = 2;
//		Weaponset.Name="Wuudy Sword";
//		Weaponset.OneHanded = true;
//		Weaponset.Quality = "";
        Weaponlist.Add(Weaponset);
    }
コード例 #18
0
ファイル: EntityInfo.cs プロジェクト: skmasq/ProjectDeagle
 public EntityInfo(string n, string cT, WeaponInfo aW, int eID, long sID, Vector3 eP, float dX, float dY, Vector3 v, int hp, int k, int tID, bool iA, bool iD)
 {
     name         = n;
     clantag      = cT;
     activeWeapon = aW;
     entityID     = eID;
     steamID      = sID;
     position     = new Vector3(eP.x, eP.z, eP.y);
     velocity     = new Vector3(v.x, v.z, v.y);
     aimDirection = new Vector2(dX, dY);
     health       = hp;
     kills        = k;
     teamID       = tID;
     isAlive      = iA;
     isDucking    = iD;
 }
コード例 #19
0
ファイル: Player.cs プロジェクト: CasualDutchman/RogueLike
 //used for when picking up weapon
 //not used, only for testing
 public void AddWeapon(Weapon w)
 {
     for (int i = 0; i < holdingWeapons.Length; i++)
     {
         if (holdingWeapons[i] == null)
         {
             holdingWeapons[i] = w;
             WeaponInfo info = new WeaponInfo();
             info.maxClipSize   = w.maxAmmo;
             info.currentAmmo   = w.maxAmmo;
             info.ammoInventory = w.maxAmmo * 5;
             weaponInfo[i]      = info;
             break;
         }
     }
 }
コード例 #20
0
        public static bool WeaponValidForTarget(WeaponInfo weapon, Actor target)
        {
            var targetable = target.TraitOrDefault <ITargetable>();

            if (targetable == null || !weapon.ValidTargets.Intersect(targetable.TargetTypes).Any())
            {
                return(false);
            }

            if (weapon.Warheads.All(w => w.EffectivenessAgainst(target) <= 0))
            {
                return(false);
            }

            return(true);
        }
コード例 #21
0
        public void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            if (string.IsNullOrEmpty(DemolishWeapon))
            {
                throw new YamlException("A value for DemolishWeapon of a Bridge trait is missing.");
            }

            var weaponToLower = DemolishWeapon.ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
            {
                throw new YamlException("Weapons Ruleset does not contain an entry '{0}'".F(weaponToLower));
            }

            DemolishWeaponInfo = weapon;
        }
コード例 #22
0
ファイル: FallsToEarth.cs プロジェクト: lujiawen/OpenRA
        public void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            if (string.IsNullOrEmpty(Explosion))
            {
                return;
            }

            var weaponToLower = Explosion.ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
            {
                throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
            }

            ExplosionWeapon = weapon;
        }
コード例 #23
0
//	public float[] ZoneMin(int zone)
//	{
//		float[] myxz = new float[2];
//
//			myxz [0] = maxDistancex [zone-1];
//			myxz [1] = maxDistancez [zone-1];
//
//
//
//		return myxz;
//
//	}

    public void SpawnHero()
    {
        HeroList.Add(Instantiate(herospawne, transform.position, transform.rotation) as GameObject);
        setter = HeroList [HeroList.Count - 1];
        setter.gameObject.name = "Hero Number " + Random.Range(1, 10);
        setter.gameObject.GetComponent <HeroAI>().myColor          = Color.blue;
        setter.gameObject.GetComponent <HeroAI>().BlackSmithBought = BlackSmithBought;
        WeaponInfo test = myitemlist.GetWeapon(1);

        setter.gameObject.GetComponent <HeroInv>().MainHandWeapon = myitemlist.GetWeapon(1);
        setter.gameObject.GetComponent <HeroInv>().blacksmith     = BlackSmithBought;
        setter.gameObject.GetComponent <HeroAI> ().HeroIdNumber   = heroIdNumber;
        setter.gameObject.GetComponent <HeroAI> ().myrole         = HeroAI.Role.Hero;
        //starting the ai shoping bias starting with weapon bais


        setter.gameObject.GetComponent <HeroAI> ().Weaponstatsbias.Add("Damage", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Weaponstatsbias.Add("Durablity", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Weaponstatsbias.Add("Range", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Weaponstatsbias.Add("Weight", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Weaponstatsbias.Add("Beauty", Random.Range(0, 10));



        // now doing armor bias
        setter.gameObject.GetComponent <HeroAI> ().Armorstatsbias.Add("Defense", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Armorstatsbias.Add("Durablity", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Armorstatsbias.Add("Weight", Random.Range(0, 10));
        setter.gameObject.GetComponent <HeroAI> ().Armorstatsbias.Add("Beauty", Random.Range(0, 10));

        //bias towards weapon types
        foreach (WeapArmorBaseInfo x in myitemlist.WeaponBases)
        {
            setter.gameObject.GetComponent <HeroAI> ().Weapontypebias.Add(x.name, Random.Range(-10, 11));
        }
        //bias towrs armor types
        foreach (WeapArmorBaseInfo x in myitemlist.ArmorBases)
        {
            setter.gameObject.GetComponent <HeroAI> ().Armortypebias.Add(x.name, Random.Range(-10, 11));
        }
        setter.gameObject.GetComponent <HeroAI> ().ArmorClassbias.Add("Light", Random.Range(-10, 11));
        setter.gameObject.GetComponent <HeroAI> ().ArmorClassbias.Add("Medium", Random.Range(-10, 11));
        setter.gameObject.GetComponent <HeroAI> ().ArmorClassbias.Add("Heavy", Random.Range(-10, 11));

        heroIdNumber += 1;
        spawnCounter  = 0.0f;
    }
コード例 #24
0
        private void btnExport_Click(object sender, EventArgs e)
        {
            SelectedObjectCollection list = lsGundam.SelectedItems;

            if (list.Count == 1)
            {
                WeaponInfo gundam = lsGundam.SelectedItem as WeaponInfo;
                if (gundam != null)
                {
                    string fileName = gundam.UUID.Replace(" ", "_") + "-" + gundam.UnitName.Replace(" ", "_") + ".weapon";

                    SaveFileDialog dialog = new SaveFileDialog();
                    //dialog.RestoreDirectory = true;
                    dialog.Filter   = "武器数据|*.weapon";
                    dialog.FileName = fileName;

                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        using (FileStream fis = new FileStream(dialog.FileName, FileMode.Create, FileAccess.Write))
                        {
                            fis.Write(gundam.Data, 0, gundam.Data.Length);
                        }
                        tsmiLblState.Text      = "导出成功";
                        tsmiLblState.ForeColor = Color.Green;
                    }
                }
            }
            else if (list.Count > 0)
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description = "请选择导出目录(自动覆盖)";

                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    foreach (Object obj in list)
                    {
                        WeaponInfo gundam = obj as WeaponInfo;
                        string     name   = dialog.SelectedPath + "\\" + gundam.UUID.Replace(" ", "_") + "-" + gundam.UnitName.Replace(" ", "_") + ".weapon";
                        export(gundam, name);
                    }
                    tsmiLblState.Text      = "导出成功";
                    tsmiLblState.ForeColor = Color.Green;

                    MessageBox.Show("导出成功", "操作提示");
                }
            }
        }
コード例 #25
0
    public void OnCycleWeaponRight(InputAction.CallbackContext ctx)
    {
        if (arsenal.Count <= 1)
        {
            return;
        }

        weaponHandler.weapon.OnFire -= Weapon_OnFire;

        WeaponInfo weapon = arsenal[0];

        arsenal.Remove(weapon);
        arsenal.Add(weapon);
        weapon.OnFire += Weapon_OnFire;

        weaponHandler.SetWeapon(arsenal[0]);
    }
コード例 #26
0
        public void ChooseScene()
        {
            Solution = new PredictionInfo();
            WeaponInfo thisWeapon = _gameContainer.WeaponList.GetRandomItem();

            if (thisWeapon.Name == "")
            {
                throw new BasicBlankException("Weapon must have name to be part of solution");
            }
            Solution.WeaponName = thisWeapon.Name;
            var thisCharacter = _gameContainer.CharacterList.GetRandomItem();

            Solution.CharacterName = thisCharacter.Name;
            var thisRoom = _gameContainer.RoomList.GetRandomItem();

            Solution.RoomName = thisRoom.Name;
        }
コード例 #27
0
    private void EquipWeapon(Weapon weapon, AmmoCounter ammoCounter)
    {
        leftHandWeapon = weapon;
        var leftHandParticleSystemChild = Instantiate(weapon.weaponPrefab, leftHandParticleSystemParent.transform);

        _leftHandBullets                = leftHandParticleSystemChild.GetComponent <ParticleSystem>();
        _leftHandSpriteSide             = weapon.spriteSide;
        _leftHandSpriteTop              = weapon.spriteTop;
        _leftHandWeaponInfo             = leftHandParticleSystemChild.GetComponent <WeaponInfo>();
        leftHandAmmoCounter             = ammoCounter;
        leftHandSpriteRendererUi.sprite = weapon.spriteUi;
        leftHandSpriteRendererUi.color  = new Color(1, 1, 1, 1);
        leftHandNameField.text          = weapon.name;
        leftHandAmmoField.text          = $"{leftHandAmmoCounter.currentAmmo}/{leftHandAmmoCounter.totalAmmo}";
        weaponAudioSource.clip          = weapon.audioClip;
        _isLeftHandFull = true;
    }
コード例 #28
0
        /// <summary>
        /// Populate this with weapon info.
        /// </summary>
        /// <param name="weapon"></param>
        public void PopulateWithInfo(Weapon weapon)
        {
            WeaponInfo settings = weapon.Settings;

            Name.text = settings.Name;
            Type.text = settings.WeaponType.ToString();
            if (weapon.Prefixes.Count > 0)
            {
                Separator.gameObject.SetActive(true);
                foreach (StatAffector affector in weapon.Prefixes)
                {
                    UIWeaponPrefix prefix = Instantiate(prefixGo, PrefixesContainer.transform).GetComponent <UIWeaponPrefix>();
                    prefix.PopulateWithInfo(affector);
                }
            }
            Dps.text = Mathf.RoundToInt(weapon.Settings.Projectile.Heatlh / weapon.Settings.ShotInterval).ToString();
        }
コード例 #29
0
    //プレイヤーにぶつかったものがCrystalだったら10個まで取得
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Crystal")
        {
            if (SceneManager.GetActiveScene().name == "Tutorial")
            {
                if (TutorialController.instance.CrystalGet == false)
                {
                    TutorialController.instance.CrystalGet = true;
                }
                else if (TutorialController.instance.CrystalGet == true)
                {
                    TutorialController.instance.CrystalGet_2 = true;
                }
            }

            MatlInfo matlInfo = other.GetComponent <MatlInfo>();
            other.GetComponent <CapsuleCollider>().enabled = false;
            if (MatlManager.NowMatl[(int)matlInfo.matlList] >= 10)
            {
                Debug.Log("所持上限を超えています");
                other.GetComponent <CapsuleCollider>().enabled = true;
                return;
            }
            else
            {
                Destroy(other.gameObject);
                MatlManager.NowMatl[(int)matlInfo.matlList]++;
            }
        }

        if (other.tag == "WeaponCrystal")
        {
            WeaponInfo weaponInfo = other.GetComponent <WeaponInfo>();
            if (WeaponManager.NowWeapon[(int)weaponInfo.weaponList] >= 5)
            {
                Debug.Log("所持上限を超えています");
                return;
            }
            else
            {
                WeaponManager.NowWeapon[(int)weaponInfo.weaponList]++;
                Destroy(other.gameObject);
            }
        }
    }
コード例 #30
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            WeaponInfo weapon = lsGundam.SelectedItem as WeaponInfo;

            if (weapon != null)
            {
                weapon.POWER    = int.Parse(txtPower.Text);
                weapon.EN       = short.Parse(txtEN.Text);
                weapon.MP       = short.Parse(txtMP.Text);
                weapon.MoveACT  = byte.Parse(txtMoveAct.Text);
                weapon.MPLimit  = short.Parse(cboMpLimit.SelectedValue.ToString());
                weapon.UseEarth = (chkUse5.Checked ? "1" : "0") + (chkUse4.Checked ? "1" : "0") + (chkUse3.Checked ? "1" : "0") + (chkUse2.Checked ? "1" : "0") + (chkUse1.Checked ? "1" : "0");
                weapon.ActEarth = cboAE5.SelectedValue.ToString() + cboAE4.SelectedValue.ToString() + cboAE3.SelectedValue.ToString() + cboAE2.SelectedValue.ToString() + cboAE1.SelectedValue.ToString();
                weapon.PROPER   = byte.Parse(cboProp.SelectedValue.ToString());
                weapon.ICO      = byte.Parse(cboIco.SelectedValue.ToString());
                weapon.Spec     = byte.Parse(cboSpec.SelectedValue.ToString());

                weapon.Range = short.Parse(cboRange.SelectedValue.ToString());

                if (txtName.Text != weapon.UnitName)
                {
                    weapon.SetUnitName(txtName.Text);
                }

                if (weapon is WeaponNormalInfo)
                {
                    (weapon as WeaponNormalInfo).HitRate  = byte.Parse(txtHitRate.Text);
                    (weapon as WeaponNormalInfo).CT       = byte.Parse(txtCT.Text);
                    (weapon as WeaponNormalInfo).HitCount = byte.Parse(txtHitCount.Text);
                }
                else
                {
                    (weapon as WeaponMapInfo).MapTurn     = short.Parse(txtMapTurn.Text);
                    (weapon as WeaponMapInfo).WeaponType  = byte.Parse(cboWeaponType.SelectedValue.ToString());
                    (weapon as WeaponMapInfo).AttMaxCount = byte.Parse(txtAttMaxCount.Text);
                }

                weapon.Save();

                weapon.Refresh();
                LoadData(weapon);

                tsmiLblState.Text      = "保存成功";
                tsmiLblState.ForeColor = Color.Green;
            }
        }
コード例 #31
0
    public static List <string> GetEquipAssets(PFashion fashionData)
    {
        if (fashionData == null)
        {
            return(new List <string>());
        }

        var fashions = GetValidFashionList(fashionData);
        var list     = new List <string>();

        foreach (var i in fashions)
        {
            if (!i)
            {
                continue;
            }

            switch (i.itemType)
            {
            //武器和枪械的都去weapon表里面获取
            case PropType.Weapon:
                var ws = WeaponInfo.GetSingleWeapons(i.subType, i.ID);
                foreach (var w in ws)
                {
                    if (!string.IsNullOrEmpty(w.model))
                    {
                        list.Add(w.model);
                    }
                    if (!string.IsNullOrEmpty(w.effects))
                    {
                        var es = Util.ParseString <string>(w.effects);
                        list.AddRange(es);
                    }
                }
                break;

            case PropType.FashionCloth:
                for (int j = 0; j < i.mesh.Length; j++)
                {
                    list.Add(i.mesh[j]);
                }
                break;
            }
        }
        return(list);
    }
コード例 #32
0
        public Err_WeaponLogicErrCode AddWeaponToSlot(EWeaponSlotType slot, WeaponInfo weapon, out WeaponInfo lastWeapon)
        {
            lastWeapon = WeaponInfo.Empty;
            if (slot == EWeaponSlotType.None)
            {
                Logger.Error("slot should not be none");
                return(Err_WeaponLogicErrCode.Err_SlotNone);
            }
            if (!_playerEntity.modeLogic.ModeLogic.IsSlotValid(slot))
            {
                Logger.ErrorFormat("slot {0} is not valid in this mode ", slot);
                return(Err_WeaponLogicErrCode.Err_SlotInvailed);
            }

            var weaponCfg = _newWeaponConfigManager.GetConfigById(weapon.Id);

            if (null == weaponCfg)
            {
                return(Err_WeaponLogicErrCode.Err_IdNotExisted);
            }
            var weaponComp = GetWeaponComponentBySlot(slot);

            if (null == weaponComp)
            {
                Logger.ErrorFormat("set weapon failed : weaponcompent in slot {0} is null", slot);
                return(Err_WeaponLogicErrCode.Err_SlotNone);
            }
            lastWeapon = GetWeaponInfo(slot);
            var attachments = weapon.GetParts();

            weapon.CopyToWeaponComponentWithDefaultParts(weaponComp);
            weaponComp.FireMode = 0;
            var avatarId = weapon.AvatarId;

            if (avatarId < 1)
            {
                avatarId = weaponCfg.AvatorId;
            }
            ProcessMountWeaponInPackage(slot.ToWeaponInPackage(), weapon.Id, avatarId);
            RefreshWeaponPartsModel(weapon.Id, slot, new WeaponPartsStruct(), attachments);
            if (slot == GetCurrentWeaponSlot())
            {
                RefreshCurrentWeaponLogic();
            }
            return(Err_WeaponLogicErrCode.Sucess);
        }
コード例 #33
0
    public override IEnumerator Init()
    {
        tableInfo.Clear();
        WeaponInfo newObj    = new WeaponInfo();
        XmlHelper  xmlHelper = XmlHelper.GetInstance();

        yield return(GameManager.GetInstance().StartCoroutine(xmlHelper.getContentsByFiledName(newObj, "Data/weapon")));

        List <object> datas = xmlHelper.alList;

        foreach (object obj in datas)
        {
            newObj = (WeaponInfo)obj;
            tableInfo.Add(newObj.id, newObj);
        }
        yield break;
    }
コード例 #34
0
    public WeaponInfo ConvertToWeaponInfo()
    {
        WeaponInfo info = new WeaponInfo();

        info.SetData(
            defaultData.weaponType,
            globalID,
            name,
            price,
            defaultData.damage,
            defaultData.speed,
            defaultData.fireRate,
            defaultData.life,
            defaultData.spread);

        return(info);
    }
コード例 #35
0
 public void ApplyEffect(GameObject enemy, WeaponInfo.EffectTypes effectype)
 {
     switch(effectype)
     {
         case (WeaponInfo.EffectTypes.FIRE):
             {
                 if (enemy.GetComponent<FireDOT>() == null)
                 {
                     enemy.AddComponent<FireDOT>();
                 }
                 else
                 {
                     FireDOT firescript = enemy.GetComponent<FireDOT>();
                     firescript.ResetTime();
                 }
                 break;
             }
         case (WeaponInfo.EffectTypes.LIGHTNING):
             {
                 if (enemy.GetComponent<LightningDOT>() == null)
                 {
                     enemy.AddComponent<LightningDOT>();
                 }
                 else
                 {
                     LightningDOT lightningscript = enemy.GetComponent<LightningDOT>();
                     lightningscript.ResetTime();
                 }
                 break;
             }
         case (WeaponInfo.EffectTypes.ICE):
             {
                 if (enemy.GetComponent<IceDOT>() == null)
                 {
                     enemy.AddComponent<IceDOT>();
                 }
                 else
                 {
                     IceDOT icescript = enemy.GetComponent<IceDOT>();
                     icescript.ResetTime();
                 }
                 break;
             }
     }
 }
コード例 #36
0
ファイル: NukePower.cs プロジェクト: AttacqueSuperior/Engine
        public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            if (!string.IsNullOrEmpty(TrailImage) && !TrailSequences.Any())
            {
                throw new YamlException("At least one entry in TrailSequences must be defined when TrailImage is defined.");
            }

            var weaponToLower = (MissileWeapon ?? string.Empty).ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
            {
                throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
            }

            WeaponInfo = weapon;

            base.RulesetLoaded(rules, ai);
        }
コード例 #37
0
ファイル: MadTank.cs プロジェクト: lujiawen/OpenRA
        public void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            var thumpDamageWeaponToLower = (ThumpDamageWeapon ?? string.Empty).ToLowerInvariant();
            var detonationWeaponToLower  = (DetonationWeapon ?? string.Empty).ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(thumpDamageWeaponToLower, out var thumpDamageWeapon))
            {
                throw new YamlException($"Weapons Ruleset does not contain an entry '{thumpDamageWeaponToLower}'");
            }

            if (!rules.Weapons.TryGetValue(detonationWeaponToLower, out var detonationWeapon))
            {
                throw new YamlException($"Weapons Ruleset does not contain an entry '{detonationWeaponToLower}'");
            }

            ThumpDamageWeaponInfo = thumpDamageWeapon;
            DetonationWeaponInfo  = detonationWeapon;
        }
コード例 #38
0
    public void EquipWeapon(GameObject newWeapon)
    {
        if (weaponInfo != null)
        {
            weaponInfo.isEquipped = false;
        }
        ;

        weapon = newWeapon;
        weapon.transform.parent   = gameObject.transform;
        weapon.transform.position = gameObject.transform.position;
        weaponInfo            = weapon.GetComponent <WeaponInfo>();
        projSpawner           = weapon.GetComponent <ProjectileSpawner>();
        weaponInfo.isEquipped = true;
        InitCenterAim();

        //weaponInfo.isAutomatic = true;
    }
コード例 #39
0
    public override WeaponInfo ToInfo()
    {
        WeaponInfo info = new WeaponInfo( weaponType, modifier );

        string dmgString = RoundStatToDecimalPlaces( damage, 3 ).ToString();

        if( weaponType == WeaponType.SCATTER_SHOT )
        {
            dmgString += " (x" + projectilesPerShot + ")";
        }

        info.AddAttribute( "Damage", dmgString );
        info.AddAttribute( "Fire Rate", RoundStatToDecimalPlaces( 1 / fireTime, 2 ) + "/s" );
        info.AddAttribute( "Projectile Speed", RoundStatToDecimalPlaces( projectileSpeed, 1 ).ToString() );
        info.AddAttribute( "Accuracy", RoundStatToDecimalPlaces( ( 1 - ( maxSpreadAngle * 2 / 180 ) ) * 100, 1 ) + "%" );

        return info;
    }
コード例 #40
0
    public static List <string> BuildWeaponSimplePreloadAssets(int proto, int gender, int weaponID, int weaponItemID, List <string> assets = null)
    {
        if (assets == null)
        {
            assets = new List <string>();
        }

        assets.Add(Creature.GetAnimatorNameSimple(weaponID, gender)); // Animator

        var w = WeaponInfo.GetWeapon(weaponID, weaponItemID);         // Main-hand weapon models

        w.GetAllAssets(assets);

        // Simple statemachine
        StateMachineInfo.GetAllAssets(weaponID, -1, assets, proto, gender, weaponItemID, -1, false, true);

        return(assets);
    }
コード例 #41
0
    public override WeaponInfo ToInfo()
    {
        WeaponInfo info = new WeaponInfo(weaponType, modifier);

        string dmgString = RoundStatToDecimalPlaces(damage, 3).ToString();

        if (weaponType == WeaponType.SCATTER_SHOT)
        {
            dmgString += " (x" + projectilesPerShot + ")";
        }

        info.AddAttribute("Damage", dmgString);
        info.AddAttribute("Fire Rate", RoundStatToDecimalPlaces(1 / fireTime, 2) + "/s");
        info.AddAttribute("Projectile Speed", RoundStatToDecimalPlaces(projectileSpeed, 1).ToString());
        info.AddAttribute("Accuracy", RoundStatToDecimalPlaces((1 - (maxSpreadAngle * 2 / 180)) * 100, 1) + "%");

        return(info);
    }
コード例 #42
0
        public static void DoImpacts(WPos pos, Actor firedBy, WeaponInfo weapon, float damageModifier)
        {
            foreach (var wh in weapon.Warheads)
            {
                var    warhead = wh;
                Action a       = () => DoImpact(pos, warhead, weapon, firedBy, damageModifier);

                if (warhead.Delay > 0)
                {
                    firedBy.World.AddFrameEndTask(
                        w => w.Add(new DelayedAction(warhead.Delay, a)));
                }
                else
                {
                    a();
                }
            }
        }
コード例 #43
0
        public override void RulesetLoaded(Ruleset rules, ActorInfo ai)
        {
            base.RulesetLoaded(rules, ai);

            if (string.IsNullOrEmpty(Weapon))
            {
                return;
            }

            var weaponToLower = Weapon.ToLowerInvariant();

            if (!rules.Weapons.TryGetValue(weaponToLower, out var weapon))
            {
                throw new YamlException($"Weapons Ruleset does not contain an entry '{weaponToLower}'");
            }

            WeaponInfo = weapon;
        }
コード例 #44
0
ファイル: WeaponUI.cs プロジェクト: rkdrnf/fortresswar
        void DrawWeaponList(WeaponInfo[] weapons)
        {
            float totalWidth = (weapons.Count() * weaponWidth);
            GUILayout.BeginArea(new Rect(Screen.width / 2 - (totalWidth / 2), Screen.height - 100f, totalWidth, 100f));
            GUILayout.BeginHorizontal();
                foreach(WeaponInfo weapon in weapons)
                {
                    GUILayout.BeginVertical();

                    GUILayout.Box(Game.Inst.weaponSet.weapons[(int)weapon.weaponType].UIImage, GUILayout.Width(80f), GUILayout.Height(30f));
                    GUIStyle ammoStyle = new GUIStyle();
                    ammoStyle.normal.textColor = Color.white;
                    GUILayout.Box(weapon.ammo + " / " + weapon.maxAmmo, ammoStyle, GUILayout.Width(100f), GUILayout.Height(30f));
                    GUILayout.Box(weapon.fireRate.ToString(), ammoStyle, GUILayout.Width(100f), GUILayout.Height(30f));
                    var con = new GUIContent();

                    GUILayout.EndVertical();
                }
            GUILayout.EndHorizontal();
            GUILayout.EndArea();
        }
コード例 #45
0
ファイル: WeaponComponent.cs プロジェクト: laazer/cs_megaman
        public void AddWeapon(string name, string entity, int ammo, int usage, HealthMeter meter, int? palette)
        {
            if (weapons.Any(info => info.Name == name))
            {
                return;
            }
            WeaponInfo weapon = new WeaponInfo
            {
                Name = name,
                Entity = entity,
                Ammo = ammo,
                Max = ammo,
                Usage = usage,
                Meter = meter,
                Palette = palette,
                Index = weapons.Count
            };

            weapons.Add(weapon);
        }
コード例 #46
0
ファイル: Shooting.cs プロジェクト: Pecke123/Genesis_Unknown
 void Start()
 {
     CurrentWeapon = WeaponList[0];
 }
コード例 #47
0
ファイル: Loader.cs プロジェクト: kiichi7/ZombieShoot
 void XMLData_CreateWeaponDB(XmlNodeList nodes)
 {
     foreach (XmlNode node in nodes){
         WeaponInfo newWeaponInfo = new WeaponInfo();
         newWeaponInfo.id = int.Parse(node.Attributes.GetNamedItem("id").Value);
         newWeaponInfo.name = node.SelectSingleNode("name").InnerText;
         newWeaponInfo.filename = node.SelectSingleNode("filename").InnerText;
         newWeaponInfo.type = int.Parse(node.SelectSingleNode("type").InnerText);
         newWeaponInfo.damage = float.Parse(node.SelectSingleNode("damage").InnerText);
         newWeaponInfo.attackRate = float.Parse(node.SelectSingleNode("attack_rate").InnerText);
         newWeaponInfo.inaccuracy = float.Parse(node.SelectSingleNode("inaccuracy").InnerText);
         newWeaponInfo.clipSize = int.Parse(node.SelectSingleNode("clipsize").InnerText);
         newWeaponInfo.maxAmmo = int.Parse(node.SelectSingleNode("maxammo").InnerText);
         DB_Weapon.Add(newWeaponInfo);
     }
 }
コード例 #48
0
ファイル: WeaponUI.cs プロジェクト: rkdrnf/fortresswar
 void DrawCurrentWeapon(WeaponInfo current)
 {
 }
コード例 #49
0
ファイル: Utils.cs プロジェクト: kiichi7/ZombieShoot
 public static WeaponInfo GetWeaponData(int id)
 {
     Loader loader = MonoBehaviour.FindObjectOfType(typeof(Loader)) as Loader;
     WeaponInfo newWeaponInfo = new WeaponInfo();
     foreach(WeaponInfo info in loader.DB_Weapon){
         if(info.id == id){
             newWeaponInfo = info;
             return newWeaponInfo;
         }
     }
     return null;
 }
コード例 #50
0
ファイル: WeaponManager.cs プロジェクト: rkdrnf/fortresswar
    public WeaponInfo TryChangeWeapon(WeaponType type, double time)
    {
        foreach (WeaponInfo weapon in weapons.Values)
            {
                if (weapon.weaponType == type)
                {
                    currentWeapon = weapon;
                    break;
                }
            }

            return currentWeapon;
    }
コード例 #51
0
ファイル: Weapon.cs プロジェクト: andy-uq/Echo
 public static Weapon Build(IIdGenerator idGenerator, WeaponInfo weaponInfo)
 {
     var id = idGenerator.NextId();
     return Build(id, weaponInfo);
 }
コード例 #52
0
ファイル: Projectile.cs プロジェクト: rkdrnf/fortresswar
 protected virtual float GetPower(WeaponInfo weapon)
 {
     return weapon.power;
 }
コード例 #53
0
ファイル: Projectile.cs プロジェクト: rkdrnf/fortresswar
    public virtual void Init(ServerPlayer player, WeaponInfo weapon, FireInfo info)
    {
        owner = player.GetOwner();
        direction = info.direction;
        GetComponent<Rigidbody2D>().AddForce(direction * GetPower(weapon), ForceMode2D.Impulse);

        long projID = ProjectileManager.Inst.GetUniqueKeyForNewProjectile();
        ProjectileManager.Inst.Set(projID, this);

        Physics2D.IgnoreCollision(collider, player.GetComponent<Collider2D>());

        OnInit();
        BroadcastInit();
    }
コード例 #54
0
 public void SetProperties(WeaponInfo info)
 {
     min_weapon_damage = info._minDamage;
     max_weapon_damage = info._maxDamage;
     _effectsToApply = info._effectsToApply;
 }
コード例 #55
0
ファイル: WeaponManager.cs プロジェクト: rkdrnf/fortresswar
    public void LoadWeapons(IEnumerable<WeaponType> weaponSet)
    {
        weapons.Clear();
            indexTypeDic.Clear();

            int i = 0;
            foreach (WeaponType weaponType in weaponSet)
            {
                WeaponInfo weapon = new WeaponInfo(Game.Inst.weaponSet.weapons[(int)weaponType]);

                weapons.Add(weapon.weaponType, weapon);
                indexTypeDic.Add(i, weaponType);
                i++;
            }

            currentWeapon = weapons.First().Value;

            ReloadAll();
    }
コード例 #56
0
 void SetWeapon(WeaponInfo info, int ammoToAdd)
 {
     if(activeWeaponController)
         Destroy(activeWeaponController.gameObject);
     Loader loader = FindObjectOfType(typeof(Loader)) as Loader;
     Object weapon = loader.GetAsset(info.filename, loader.FileDB_Weapon);
     GameObject w_go = Instantiate(weapon, weaponBone.position, weaponBone.rotation) as GameObject;
     w_go.transform.parent = weaponBone;
     activeWeaponController = w_go.GetComponent<WeaponController>();
     activeWeaponController.info = info;
     activeWeaponController.owner = gameObject.GetComponent<PlayerController>();
     weaponDD.ammoInClip = info.clipSize;
     weaponDD.hasAmmo = ammoToAdd;
     ApplyAnimationState();
 }
コード例 #57
0
 void Start()
 {
     CurrentWeapon = WeaponList[0];
     startPos = SwayHolder.transform.localPosition;
     linerenderer.enabled = false;
     linerenderer.light.enabled = false;
 }
コード例 #58
0
 void Start()
 {
     info = (WeaponInfo)(Utils.GetWeaponData(weaponID));
     if(ammoToAdd > info.maxAmmo)
         ammoToAdd = info.maxAmmo;
 }
コード例 #59
0
ファイル: Grenade.cs プロジェクト: rkdrnf/fortresswar
 protected override float GetPower(WeaponInfo weapon)
 {
     float multiplier = (float)(weapon.chargeTimer / weapon.maxChargeTime);
     if (multiplier > 1 ) multiplier = 1f;
     return weapon.power * multiplier;
 }