public virtual void CallOnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
        {
            //If MyEquippedWeaponType Hasn't Been Set, Do Not Update MyUnequippedWeaponType
            if (MyEquippedWeaponType != EWeaponType.NoWeaponType)
            {
                MyUnequippedWeaponType = MyEquippedWeaponType;
            }
            MyEquippedWeaponType = _weaponType;
            if (globalStatHandler &&
                globalStatHandler.WeaponStatDictionary.ContainsKey(MyEquippedWeaponType) &&
                globalStatHandler.WeaponStatDictionary.ContainsKey(MyUnequippedWeaponType))
            {
                MyEquippedWeaponIcon =
                    globalStatHandler.WeaponStatDictionary
                    [MyEquippedWeaponType].WeaponIcon;
                if (MyUnequippedWeaponType != EWeaponType.NoWeaponType)
                {
                    MyUnequippedWeaponIcon =
                        globalStatHandler.WeaponStatDictionary
                        [MyUnequippedWeaponType].WeaponIcon;
                }
            }

            if (OnWeaponChanged != null)
            {
                OnWeaponChanged(_eType, _weaponType, _wUsage, _equipped);
            }
        }
Example #2
0
        public Weapon(EWeaponType mweapontype, int minmagicalattack, int maxmagicalattack, string name)
            : base(EItemType.Weapon, EItemFunctionality.Wearable, name)
        {
            minMagicalAttack = minmagicalattack;

            maxMagicalAttack = maxmagicalattack;
        }
Example #3
0
 void OnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (_equipped)
     {
         UpdateWeaponUiGameObjects(_eType);
     }
 }
Example #4
0
    //전략패턴을 활용 무기 변경시 현재 무기 타입에 무기 클래스를 넣어주고
    //현재 무기 데이터에 무기 타입에 맞춰 넣어줌
    void changeWeapon(EWeaponType weaponState, int key_)
    {
        switch (weaponState)
        {
        case EWeaponType.Pistol:
            weapon.setWeapon(new Pistol());
            setWeaponData(key_, WeaponData.PISTOL_FIRE_RATE, WeaponData.PISTOL_RELOAD_SPEED,
                          pistolBullets, pistolFireFlame, pistolStartPos);
            break;

        case EWeaponType.Rifle:
            weapon.setWeapon(new RifleGun());
            setWeaponData(key_, WeaponData.RIFLE_FIRE_RATE, WeaponData.RIFLE_RELOAD_SPEED,
                          rifleBullets, rifleFireFlame, longGunStartPos);
            break;

        case EWeaponType.ShotGun:
            weapon.setWeapon(new ShotGun());
            setWeaponData(key_, WeaponData.SHOTGUN_FIRE_RATE, WeaponData.SHOTGUN_RELOAD_SPEED,
                          shotGunBullets, shotGunFireFlame, longGunStartPos);
            break;

        default: Debug.Log("Finding gun state is failed"); break;
        }
    }
Example #5
0
    public static bool CheckRange(this Vessel vessel, Vessel target, EWeaponType weapon)
    {
        float distance = Vector3.Distance(vessel.transform.position, target.transform.position);

        switch (weapon)
        {
        case EWeaponType.ANTI_AIR:
            return(true);

        case EWeaponType.BOMB:
            return(vessel.gunPower > 0);

        case EWeaponType.AERIAL_TORPEDO:
            return(vessel.torpedoPower > 0);

        case EWeaponType.AERIAL_ASW:
            return(vessel.aswPower > 0);

        case EWeaponType.GUN:
            return(vessel.gunPower > 0 && distance < vessel.gunRange);

        case EWeaponType.TORPEDO:
            return(vessel.torpedoPower > 0 && distance < vessel.torpedoRange);

        case EWeaponType.ASW:
            return(vessel.aswPower > 0 && distance < vessel.aswRange);

        default:
            return(false);
        }
    }
Example #6
0
    public override NotPlayerEntity CreateNotPlayerEntity(EntityType entityType, EWeaponType curWeapon, Vector3 spawnPoint)
    {
        NotPlayerEntity entity     = null;
        string          prefabName = "";

        switch (entityType)
        {
        case EntityType.EntityType_NotPlayerZombie:
            entity = new NotPlayerZombie();
            break;

        case EntityType.EntityType_NotPlayerSkeleton:

            break;

        case EntityType.EntityType_NotPlayerGaint:

            break;

        default:
            entity = new NotPlayerZombie();
            break;
        }

        return(entity);
    }
Example #7
0
 public Weapon(int power, ISet <int> range, EDamageType damageType, EWeaponType weaponType)
 {
     Power      = power;
     Range      = range;
     DamageType = damageType;
     WeaponType = weaponType;
 }
 void OnWeaponTypeChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (_equipped)
     {
         SetEquippedItem(GetTPSItemFromWeaponType(_weaponType));
     }
 }
        ItemType GetTPSItemFromWeaponType(EWeaponType _weaponType)
        {
            switch (_weaponType)
            {
            case EWeaponType.Fist:
                return(FistType);

            case EWeaponType.Knife:
                return(KnifeType);

            case EWeaponType.Pistol:
                return(PistolType);

            case EWeaponType.AssaultRifle:
                return(AssualtRifleType);

            case EWeaponType.Shotgun:
                return(ShotgunType);

            case EWeaponType.SniperRifle:
                return(SniperRifleType);

            case EWeaponType.Axe:
                return(AxeType);

            case EWeaponType.Crossbow:
                return(CrossbowType);

            case EWeaponType.Katana:
                return(KatanaType);

            default:
                return(null);
            }
        }
Example #10
0
 private TurnAction(Player executingPlayer, Coordinate force, EWeaponType weapon, bool tracer)
 {
     Player = executingPlayer;
     Force  = force;
     Weapon = weapon;
     Tracer = tracer;
 }
    public bool SetWeaponTypeToSwitchTo(EWeaponType type, int ammoCount)
    {
        WeaponTypeToSwitchTo = type;
        bDirtySwitchWeapon   = true;
        NextAmmoCount        = ammoCount;

        return(null == CurrentWeapon);
    }
Example #12
0
        private WeaponView CreateWeapon(EWeaponType weaponType, Transform root)
        {
            var weaponView = _container.InstantiatePrefabResourceForComponent <WeaponView>("Weapons/" + weaponType);

            weaponView.transform.parent        = root;
            weaponView.transform.localPosition = Vector3.zero;
            weaponView.transform.localRotation = Quaternion.identity;
            return(weaponView);
        }
Example #13
0
 public Weapon(int power, ISet <int> range, int accuracy, int crit, EDamageType damageType, EWeaponType weaponType)
 {
     Power      = power;
     Range      = range;
     Accuracy   = accuracy;
     Crit       = crit;
     DamageType = damageType;
     WeaponType = weaponType;
 }
Example #14
0
    // ========================================================================== //

    /* protected - Override & Unity API         */

    protected override void OnAwake()
    {
        base.OnAwake();
        if (p_randSpawn)
        {
            p_eItemType = (EWeaponType)Random.Range(0, 5.999f);
        }
        DoSpawn_Weapon(false);
    }
Example #15
0
        // Special case! If user paid for the game, make sure he always starts with max ammo for his current weapon level
        public void SetAmmoToMax(EWeaponType weaponType)
        {
            WeaponInstance weapon = Ammo [(int)weaponType];
            CMLData        update = new CMLData();

            //update the value locally also
            Stock.Seti(weapon.Weapon.WeaponName, weapon.MaxAmmo);
            update.Seti(weapon.Weapon.WeaponName, weapon.MaxAmmo);
            WUData.UpdateCategory(category_name_inventory, update);
        }
 protected virtual void OnWeaponChanged(EEquipType _eType, EWeaponType _weaponType, EWeaponUsage _wUsage, bool _equipped)
 {
     if (IsInvoking("UpdateBattleBehavior"))
     {
         bool       _commandAttackRestart = myEventHandler.bIsCommandAttacking ? true : false;
         AllyMember _currentTargetRestart = currentTargettedEnemy;
         myEventHandler.CallEventFinishedMoving();
         myEventHandler.CallEventStopTargettingEnemy();
         StartCoroutine(OnWeaponChangedDelay(_commandAttackRestart, _currentTargetRestart));
     }
 }
Example #17
0
 public void GetWeapon()
 {
     if (Input.GetKey("1"))
     {
         eWeaponType = EWeaponType.mainWeapon;
     }
     else if (Input.GetKey("2"))
     {
         eWeaponType = EWeaponType.plasmWeapon;
     }
 }
Example #18
0
        /// <summary>
        /// It's not really a Handler right now. When the game starts,
        /// this method is called to update the unequipped weapon type
        /// on the allyEventHandler.
        /// </summary>
        void UpdateUnequippedWeaponType()
        {
            //Explicitly Set Weapon Because Unequipped weapon type
            //on allyEventHandler doesn't become set till OnDelayStart
            EWeaponType _weapon = myCharacterStats.EquippedWeapon == EEquipType.Primary ?
                                  myCharacterStats.SecondaryWeapon : myCharacterStats.PrimaryWeapon;

            eventHandler.UpdateUnequippedWeaponStats(
                GetWeaponStatsFromWeaponType(
                    _weapon));
        }
    void SetWeapon(int Index)
    {
        Debug.Log("Set Weapon: " + "(" + ActiveWeapon + "), Weapon Name: " + AvailableWeapons[ActiveWeapon].WeaponName);

        ActiveWeapon    = Index;
        MF.mesh         = AvailableWeapons[ActiveWeapon].WeaponMesh;
        Projectile      = AvailableWeapons[ActiveWeapon].Projectile;
        WeaponMode      = AvailableWeapons[ActiveWeapon].WeaponType;
        FireRate        = AvailableWeapons[ActiveWeapon].FireRate;
        MaximumCapacity = AvailableWeapons[ActiveWeapon].Capacity;
    }
 public Weapon(string _name, int _attack, int _accuracy, int _criticalChance, EWeaponType _type, int _cost, int _level)
 {
     name           = _name;
     attack         = _attack;
     type           = _type;
     accuracy       = _accuracy;
     criticalChance = _criticalChance;
     cost           = _cost;
     level          = _level;
     itemType       = EItemType.WEAPON;
 }
Example #21
0
        public static bool MayHasPart(this EWeaponType weaponType)
        {
            switch (weaponType)
            {
            case EWeaponType.PrimeWeapon:
            case EWeaponType.SubWeapon:
                return(true);

            default:
                return(false);
            }
        }
Example #22
0
        public static bool CanAutoPick(this EWeaponType weaponType)
        {
            switch (weaponType)
            {
            case EWeaponType.MeleeWeapon:
            case EWeaponType.PrimeWeapon:
            case EWeaponType.SubWeapon:
            case EWeaponType.TacticWeapon:
                return(true);

            default:
                return(false);
            }
        }
Example #23
0
        /// <summary>
        /// Iterate through all tanks and check if in area of effect for the given weapon
        /// </summary>
        /// <param name="collisionPoint"></param>
        /// <param name="weapon"></param>
        private void TestTanksCollisionAt(Coordinate collisionPoint, EWeaponType weapon)
        {
            float aoe = AreaOfEffectMap[weapon];

            foreach (Player player in m_players)
            {
                Coordinate tankPos  = player.ControlledTank.Position;
                float      distance = Coordinate.Distance(tankPos, collisionPoint);
                if (distance < aoe)
                {
                    player.ControlledTank.Damage(weapon, DamageMap[weapon]);
                }
            }
        }
Example #24
0
        private void AddWeapon(EWeaponType weaponType)
        {
            var item = View.CollectionWeaponItem.AddItem();

            item.TextName.text            = weaponType.ToString();
            item.WeaponType               = weaponType;
            item.ImageCooldown.fillAmount = 0f;
            MarkSelect(item, false);

            //for mobile version
            item.ButtonSelect.OnClickAsObservable()
            .Subscribe(x => OnClickButtonSelect(item.WeaponType))
            .AddTo(item.ButtonSelect);
        }
    public void DoSetWeapon(EWeaponType eWeaponType, Transform pTransWeaponModel)
    {
        _eWeaponType = eWeaponType;
        _pControl_Animator.DoSetParam_Int(EAnimatorParam.WeaponType_int, (int)eWeaponType);

        try
        {
            _pEquipHand_Right.DoSetEquipment(pTransWeaponModel);
        }
        catch
        {
            Debug.Log("Error", this);
        }
    }
Example #26
0
    public override PlayerEntity CreatePlayerEntity(EntityType entityType, EWeaponType curWeapon, Vector3 spawnPoint)
    {
        PlayerEntity entity     = null;
        GameObject   tmpGo      = null;
        string       prefabName = "";

        switch (entityType)
        {
        case EntityType.EntityType_PlayerRifeMan:
            entity     = new PlayerRifeMan();
            prefabName = "RifeMan";
            break;

        case EntityType.EntityType_PlayerMaskMan:
            entity     = new PlayerMaskMan();
            prefabName = "MaskMan";
            break;

        default:
            entity     = new PlayerRifeMan();
            prefabName = "RifeMan";
            break;
        }
        //先读取预设
        tmpGo = GlobalClient.Instance.objPoolManager.Get <PlayerEntity>();
        if (tmpGo == null)
        {
            entity = tmpGo.GetComponent <PlayerEntity>();
        }
        //設置模型

        //创建武器
        IWeapon weapon = CreateWeapon(curWeapon);

        entity.weapon = weapon;
        //创建属性
        PlayerEntityAttr attr = CreatePlayerEntityAttr(0);

        entity.SetEntityAttribute(attr);
        //创建ai行为
        PlayerEntityAIController aiController = CreatePlayerEntityAIController();

        entity.aiController = aiController;

        //添加到实体管理器
        GlobalClient.Instance.entityManager.AddPlayerdEntity(entity);
        return(entity);
    }
Example #27
0
    private IWeapon SearchItem(EWeaponType weaponType, ref List <IWeaponData> weaponsData)
    {
        var searched = from currentData in weaponsData
                       where currentData.Weapon.WeaponInfo.WeaponType == weaponType
                       select currentData;

        if (searched != null && searched.Count() >= 1)
        {
            IWeaponData data = searched.FirstOrDefault();
            weaponsData.Remove(data);
            return(data.Weapon);
        }
        else
        {
            throw new Exception("Invertory structure is incorrect!");
        }
    }
        public void SetCurrentWeapon(Entity player, EWeaponType weaponType)
        {
            var weaponsComponent = player.getComponent <WeaponsComponent>();

            foreach (var weapon in weaponsComponent.Weapons)
            {
                if (weapon.Type != weaponType)
                {
                    weapon.gameObject.SetActive(false);
                }
                else
                {
                    weapon.gameObject.SetActive(true);
                    weaponsComponent.CurrentWeaponView = weapon;
                }
            }
        }
Example #29
0
 public RangedWeaponInfo(string weaponName,
                         int shellDamage, int numberOfAmmoInMagazine, int maximumMagazineSize,
                         float reloadTime, float shootDurationTime, EWeaponType weaponType,
                         ISlashLogic meleeProperties, Transform bulletSpawn, LayerMask damagabaleLayer)
 {
     this.WeaponName             = weaponName;
     ShellDamage                 = shellDamage;
     this.numberOfAmmoInMagazine = numberOfAmmoInMagazine;
     this.maximumMagazineSize    = maximumMagazineSize;
     this.currentAmmoInMagazine  = numberOfAmmoInMagazine;
     this.currentAmmoMax         = this.MaximumAmmunition - numberOfAmmoInMagazine;
     this.reloadTime             = reloadTime;
     this.shootDurationTime      = shootDurationTime;
     this.weaponType             = weaponType == EWeaponType.Melee ? EWeaponType.Pistol : weaponType;
     this.meleeProperties        = meleeProperties;
     this.bulletSpawn            = bulletSpawn;
     this.damagableLayer         = damagabaleLayer;
 }
        private EWeaponSlotType GetMatchSlot(EWeaponType weaponType)
        {
            switch (weaponType)
            {
            case EWeaponType.PrimeWeapon:
                var hasPrime = _weaponBagLogic.HasWeaponInSlot(EWeaponSlotType.PrimeWeapon1);
                if (hasPrime && _weaponSlotController.IsSlotValid(EWeaponSlotType.PrimeWeapon2))
                {
                    return(EWeaponSlotType.PrimeWeapon2);
                }
                else
                {
                    return(EWeaponSlotType.PrimeWeapon1);
                }

            default:
                return(weaponType.ToWeaponSlot());
            }
        }
Example #31
0
		public SItem( string name, int sockel ) {
			mName = name;
			mSockel = sockel;
			mWeaponType = EWeaponType.None;
		}
Example #32
0
		public SItem( string name, int sockel, EWeaponType wt ) {
			mName = name;
			mSockel = sockel;
			mWeaponType = wt;
		}