Ejemplo n.º 1
0
 public WeaponBehaviour(Transform[] muzzles, GameObject bulletPrefab, IWeaponData data, IInput <bool> input, IAudioGraphicBehaviourController <bool> controller) :
     base(input, controller)
 {
     weaponData        = data;
     this.muzzles      = muzzles;
     this.bulletPrefab = bulletPrefab;
 }
Ejemplo n.º 2
0
 void Start()
 {
     weaponData              = GameObject.FindGameObjectWithTag("Controller").GetComponent <IWeaponData>();
     dataManager             = GameObject.FindGameObjectWithTag("Controller").GetComponent <DataManager>();
     bulletsLenth            = bullets.Count;
     bulletLevel             = 1;
     GameController.OnStart += ReInit;
 }
Ejemplo n.º 3
0
        public WeaponReplication(IWeaponData weaponData, ICustomCastObject castObject) : base(castObject)
        {
            _weaponData = weaponData;

            weaponData.DamageUpdated += OnDamageUpdated;

            _getterDic.Add(nameof(_weaponData.Id), () => _weaponData.Id);
            _setterDic.Add(nameof(_weaponData.Id), obj => _weaponData.Id = _castObject.To <string>(obj));
            _getterDic.Add(nameof(_weaponData.Damage), () => _weaponData.Damage);
            _setterDic.Add(nameof(_weaponData.Damage), obj => _weaponData.Damage = _castObject.To <uint>(obj));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Constructs a StandardWeapon instance.
        /// </summary>
        /// <param name="owner">Reference to the entity that this standard weapon belongs to.</param>
        /// <param name="weaponData">The definition of the weapon from the metadata.</param>
        public StandardWeapon(Entity owner, IWeaponData weaponData)
            : base(owner, weaponData.Missiles)
        {
            if (weaponData == null)
            {
                throw new ArgumentNullException("weaponData");
            }
            this.weaponData = weaponData;

            this.frameIndexOfLastLaunch = this.ConstructField <int>("frameIndexOfLastLaunch");
            this.frameIndexOfLastLaunch.Write(-1);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Constructs a CustomWeaponStub instance.
        /// </summary>
        /// <param name="owner">Reference to the entity that this custom weapon stub belongs to.</param>
        /// <param name="weaponData">The definition of the weapon from the metadata.</param>
        internal CustomWeaponStub(Entity owner, IWeaponData weaponData)
            : base(owner, weaponData.Missiles)
        {
            if (weaponData == null)
            {
                throw new ArgumentNullException("weaponData");
            }
            this.weaponData = weaponData;

            this.attachedWeapon = this.ConstructField <CustomWeapon>("attachedWeapon");
            this.attachedWeapon.Write(null);
        }
Ejemplo n.º 6
0
            static partial void FillBinaryFlags2Custom(MutagenFrame frame, IWeaponData item)
            {
                var flags2 = frame.ReadUInt32();

                flags2 <<= UpperFlagShift;

                // Clean existing flags
                var flags = (uint)item.Flags;

                flags &= ~UpperFlagMask;

                flags     |= flags2;
                item.Flags = (WeaponData.Flag)flags;
            }
Ejemplo n.º 7
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!");
        }
    }
Ejemplo n.º 8
0
        /// <summary>
        /// Constructs a WeaponDataUpgrade instance.
        /// </summary>
        /// <param name="metadataUpgrade">The metadata upgrade that this instance belongs to.</param>
        /// <param name="originalWeaponData">The original weapon data that this instance is upgrading.</param>
        public WeaponDataUpgrade(ScenarioMetadataUpgrade metadataUpgrade, IWeaponData originalWeaponData)
        {
            if (metadataUpgrade == null)
            {
                throw new ArgumentNullException("metadataUpgrade");
            }
            if (originalWeaponData == null)
            {
                throw new ArgumentNullException("originalWeaponData");
            }

            this.metadataUpgrade     = metadataUpgrade;
            this.missileDataWrappers = new List <MissileDataWrapper>();

            this.damageModifier   = new IntValueModifier();
            this.cooldownModifier = new IntValueModifier();
            this.rangeMaxModifier = new IntValueModifier();
            this.rangeMinModifier = new IntValueModifier();

            this.Reset(originalWeaponData);
        }
Ejemplo n.º 9
0
        /// <summary>
        /// Resets this instance.
        /// </summary>
        /// <param name="originalWeaponData">The original weapon data that this instance is upgrading.</param>
        internal void Reset(IWeaponData originalWeaponData)
        {
            if (originalWeaponData == null)
            {
                throw new ArgumentNullException("originalWeaponData");
            }

            this.originalWeaponData  = originalWeaponData;
            this.originalUpdateIface = originalWeaponData as IWeaponDataUpgrade;

            this.damageModifier.AttachModifiedValue(this.originalWeaponData.Damage);
            this.cooldownModifier.AttachModifiedValue(this.originalWeaponData.Cooldown);
            this.rangeMaxModifier.AttachModifiedValue(this.originalWeaponData.RangeMax);
            this.rangeMinModifier.AttachModifiedValue(this.originalWeaponData.RangeMin);

            this.missileDataWrappers.Clear();
            foreach (IMissileData originalMissileData in this.originalWeaponData.Missiles)
            {
                this.missileDataWrappers.Add(new MissileDataWrapper(this, originalMissileData));
            }
        }
Ejemplo n.º 10
0
 public WeaponModel(IWeaponData data)
 {
     _data = data;
 }
Ejemplo n.º 11
0
 public HomeController()
 {
     db = new InMemoryWeaponData();
 }
Ejemplo n.º 12
0
 public DisplayByIdModel(ICitizenData citizenData, IWeaponData weaponData)
 {
     _citizenData = citizenData;
     _weaponData  = weaponData;
 }
Ejemplo n.º 13
0
 static partial void FillBinaryFlagsCustom(MutagenFrame frame, IWeaponData item)
 {
     // Read normally
     item.Flags = (WeaponData.Flag)frame.ReadUInt16();
 }
Ejemplo n.º 14
0
 void Start()
 {
     scoreData  = GameObject.FindGameObjectWithTag("Controller").GetComponent <IScoreData>();
     weaponData = GameObject.FindGameObjectWithTag("Controller").GetComponent <IWeaponData>();
     GameController.OnGameOver += Init;
 }
Ejemplo n.º 15
0
 public CreateModel(ICitizenData citizenData, IWeaponData weaponData)
 {
     _citizenData = citizenData;
     _weaponData  = weaponData;
 }