示例#1
0
 private void Start()
 {
     curWeapon = this.GetComponent <Player>().curWeapon;
     joybutton = FindObjectOfType <DynamicJoybutton>();
     joybutton.PressUpNotify   += Joybutton_PressUpNotify;
     joybutton.PressDownNotify += Joybutton_PressDownNotify;
 }
示例#2
0
 private void UneqipRange()
 {
     onItemUnequip?.Invoke(meleeWeapon);
     rangeWeapon = null;
     Destroy(currentRangeWeaponGameObject);
     currentRangeWeaponGameObject = null;
 }
        public ActionResult DeleteConfirmed(int id)
        {
            RangeWeapon rangeWeapon = db.RangeWeapons.Find(id);

            db.RangeWeapons.Remove(rangeWeapon);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#4
0
 private void AddEquipment()
 {
     meleeWeapons = new List <MeleeWeapons>();
     meleeWeapons.Add(new SideArm());
     meleeWeapons.Add(null);
     meleeWeapons.Add(null);
     rangeWeapon = new GoodOldFists();
 }
        public void Equip(RangeWeapon newItem)
        {
            int itemIndex = (int)newItem.equipmentSlot;

            Unequip(itemIndex);
            rangeWeapon = newItem;
            ShowEquipment(newItem);
            onItemEquip?.Invoke(newItem);
        }
示例#6
0
    void RpcFire()
    {
        //Get the access to the target
        RangeWeapon script = currentWeapon.GetComponent <RangeWeapon>();

        //Set the camera then perform attack
        script.SetCamera(playerCam);
        script.Fire(isServer);
    }
 public ActionResult Edit([Bind(Include = "RangeWeaponID,RanWeapName,RanWeapRange,RanWeapArmorIgnore,Description")] RangeWeapon rangeWeapon)
 {
     if (ModelState.IsValid)
     {
         db.Entry(rangeWeapon).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(rangeWeapon));
 }
        public ActionResult Create([Bind(Include = "RangeWeaponID,RanWeapName,RanWeapRange,RanWeapArmorIgnore,Description")] RangeWeapon rangeWeapon)
        {
            if (ModelState.IsValid)
            {
                db.RangeWeapons.Add(rangeWeapon);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(rangeWeapon));
        }
示例#9
0
文件: Ranged.cs 项目: Kotvitskiy/AoS
 public override void Update()
 {
     if (!isInitialized)
     {
         _armor         = 0;
         _range         = 120;
         _hp            = 30;
         _damage        = 7;
         _gun           = new RangeWeapon(_damage, GameScene.Instance);
         _cooldownValue = 60;
         _speed         = 1;
     }
     base.Update();
 }
示例#10
0
 public void AddRangeWeapon(RangeWeapon _target, int _ammoInMagazines, int _currentAmmo)
 {
     foreach (Weapon weapon in weapons)
     {
         if (weapon.weaponType == WeaponType.RANGE) //jeżeli gracz już posiada ten typ broni
         {
             Drop(weapon, transform);
             break;
         }
     }
     weapons.Insert(0, _target);
     ammoInMagazines     = _ammoInMagazines;
     currentAmountOfAmmo = _currentAmmo;
 }
        // GET: RangeWeapons/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            RangeWeapon rangeWeapon = db.RangeWeapons.Find(id);

            if (rangeWeapon == null)
            {
                return(HttpNotFound());
            }
            return(View(rangeWeapon));
        }
示例#12
0
 public override void EquipUnit(Equipment input)
 {
     if (input is RangeWeapon)
     {
         rangeWeapon = input as RangeWeapon;
     }
     else if (input is MeleeWeapons)
     {
         AddWeapon(input as MeleeWeapons);
     }
     else
     {
         base.EquipUnit(input);
     }
 }
示例#13
0
    void Start()
    {
        centerTransform          = transform.GetChild(0);
        centerTransform.rotation = transform.rotation;
        this.direction           = this.transform.eulerAngles;
        this.position            = this.transform.position;
        this.currentSpeed        = 0.0f;

        targetDetected = targetCanBeSeen = targetInLineOfSight = targetInShootingRange = false;

        movementAI = GetComponent <MovementAI>();
        GameObject  weaponObject = Instantiate(weaponPrefab);
        RangeWeapon weapon       = weaponObject.GetComponent <RangeWeapon>();

        equipAction = GetComponent <EquipAction>();
        equipAction.EquipItem(weapon, this.centerTransform);
    }
示例#14
0
    public void WeaponDisplay()
    {
        Equipment weaponEquipment = player.equipments[EquipmentType.Weapon];

        if (weaponEquipment != null)
        {
            RangeWeapon rangeWeapon = weaponEquipment as RangeWeapon;
            if (rangeWeapon != null)
            {
                txtAmmo.text = "Ammo: " + rangeWeapon.GetAmmoCount();
            }
        }
        else
        {
            txtAmmo.text = "No range weapon selected";
        }
    }
    /// <summary>
    /// Only to be used when CanAttack has been checked.
    /// Creates a new damage region based on the currently equipt weapon and the enity look direction.
    ///
    /// </summary>
    public void UseEquiptWeapon()
    {
        stopwatch.Restart();
        //Find damage absed on either unarmed
        float      damage     = UnarmedAttackDamage;
        DamageType damageType = DamageType.BLUNT;
        float      staminaUse = UnarmedAttackStaminaUse;

        //If weapon is not null, apply correct damage
        if (EquiptWeapon != null)
        {
            damage     = EquiptWeapon.Damage;
            damageType = EquiptWeapon.DamageType;
            staminaUse = EquiptWeapon.AttackStaminaUse;

            if (damageType == DamageType.BLUNT)
            {
                damage *= Entity.SkillTree.BluntWeapons.GetBonus();
            }
            else if (damageType == DamageType.SHARP)
            {
                damage *= Entity.SkillTree.SharpWeapons.GetBonus();
            }
        }

        CurrentStamina -= staminaUse;
        if (EquiptWeapon is RangeWeapon)
        {
            RangeWeapon rw = EquiptWeapon as RangeWeapon;
            SpellManager.Instance.AddNewProjectile(Entity.Position, EntityLookAngleToEulerLook2D(Entity.LookAngle), rw.GenerateProjectile(), Entity, Entity.LookAngle);
            //GameManager.WorldManager.AddNewProjectile(Entity.Position, EntityLookAngleToEulerLook2D(Entity.LookAngle), rw.GenerateProjectile(), Entity, Entity.LookAngle);
        }
        else
        {
            //Instruct animation manager to play attack animation
            Entity.GetLoadedEntity().AnimationManager.HumanoidCast().AttackLeft();

            //Calculate the final dealth damage, based on entity skill tree modifiers and the weapons base damage.


            LoadedMeleeWeapon?.SwingWeapon(damage);
        }
    }
示例#16
0
    void Start()
    {
        playerView.enabled               = true;
        playerView.transform.position    = transform.position + Vector3.up * .5f;
        playerView.transform.eulerAngles = this.direction = transform.eulerAngles;
        playerView.fieldOfView           = 95f;

        itemAction = GetComponent <EquipAction>();

        this.currentSpeed = this.maxSpeed;

        if (weaponPrefab != null)
        {
            GameObject  weaponObject = (GameObject)Instantiate(weaponPrefab);
            RangeWeapon weapon       = weaponObject.GetComponent <RangeWeapon>();
            itemAction.EquipItem(weapon, playerView.transform);
        }
        Cursor.lockState = CursorLockMode.Locked;
        position         = transform.position;
    }
    private void SetEnemy(int index)
    {
        switch (index)
        {
        //para os inimigos que usam armas a distância
        case 0:
        case 1:
            Enemy rangeEnemy = instance.GetComponent <Enemy>();
            int   spawnIndex = Random.Range(0, rangeSpawn.Count);

            rangeEnemy.StartEnemy(rangeSpawn[spawnIndex].transform.position, enemyPool[index], playerObj);
            rangeEnemy.spawn = rangeSpawn[spawnIndex];
            if (rangeEnemy.capsuleCollider != null)
            {
                rangeEnemy.capsuleCollider.enabled = true;
            }

            rangeSpawn.Remove(rangeSpawn[spawnIndex]);

            RangeWeapon rangeWeapon = instance.GetComponent <RangeWeapon>();
            rangeWeapon.pool = projectilePool[index];
            break;

        //para inimigos de ataque corpo a corpo
        case 2:
        case 3:
            Enemy   meleeEnemy = instance.GetComponent <Enemy>();
            Vector3 spawnPos   = new Vector3(Random.Range(-16, 16), 0, Random.Range(-16, 16));
            meleeEnemy.StartEnemy(spawnPos, enemyPool[index], playerObj);
            if (meleeEnemy.capsuleCollider != null)
            {
                meleeEnemy.capsuleCollider.enabled = true;
            }
            break;
        }

        instance.SetActive(true);
    }
示例#18
0
    public override void UseItem(Human human)
    {
        if (human.PersonWeapon is RangeWeapon)
        {
            RangeWeapon weapon = (RangeWeapon)human.PersonWeapon;
            if (weapon.AmmunitionType.AmmunitionType == this.AmmunitionType)
            {
                int count = weapon.AmmunitionType.NowInStack + this.NowInStack;

                if (weapon.AmmunitionType.MaxInStack <= count)
                {
                    count            = weapon.AmmunitionType.MaxInStack - weapon.AmmunitionType.NowInStack;
                    this.NowInStack -= count;
                    weapon.AmmunitionType.NowInStack = weapon.AmmunitionType.MaxInStack;
                }
                else
                {
                    weapon.AmmunitionType.NowInStack += this.NowInStack;
                    this.NowInStack = 0;
                }
            }
        }
    }
示例#19
0
 public override void RemoveEquipment(Equipment output)
 {
     if (output is RangeWeapon)
     {
         rangeWeapon = new GoodOldFists();
     }
     else if (output is MeleeWeapons)
     {
         for (int i = 0; i < meleeWeapons.Count; i++)
         {
             if (meleeWeapons[i] == output)
             {
                 meleeWeapons[i] = meleeWeapons[meleeWeapons.Count - 1];
                 meleeWeapons[meleeWeapons.Count - 1] = null;
             }
         }
         int p = 0;
     }
     else
     {
         base.RemoveEquipment(output);
     }
 }
示例#20
0
        public void Execute(TriggerEvent triggerEvent)
        {
            Entity entityA = triggerEvent.Entities.EntityA;
            Entity entityB = triggerEvent.Entities.EntityB;
            bool   entityAIsHealthPickup    = FireRatePickupGroup.Exists(entityA);
            bool   entityBIsPlayerCharacter = playerCharacterGroup.Exists(entityB);

            if (entityAIsHealthPickup && entityBIsPlayerCharacter)
            {
                WeaponBonusPickUp FireRatePickUp = FireRatePickupGroup[entityA];
                var         characterEntity      = CharacterGroup[entityB].ActiveRangeWeaponEntity;
                RangeWeapon weapon = RangeWeaponGroup[characterEntity];

                weapon.FiringRate                += FireRatePickUp.additionnalFireRate;
                weapon.BulletAmountPerShot       *= FireRatePickUp.bulletPerShotMultiplier;
                RangeWeaponGroup[characterEntity] = weapon;

                entityCommandBuffer.DestroyEntity(entityA);
            }
            else
            {
                bool entityAIsPlayerCharacter = playerCharacterGroup.Exists(entityA);
                bool entityBIsHealthPickUp    = FireRatePickupGroup.Exists(entityB);
                if (entityAIsPlayerCharacter && entityBIsHealthPickUp)
                {
                    WeaponBonusPickUp FireRatePickUp = FireRatePickupGroup[entityB];
                    var         characterEntity      = CharacterGroup[entityA].ActiveRangeWeaponEntity;
                    RangeWeapon weapon = RangeWeaponGroup[characterEntity];

                    weapon.FiringRate                += FireRatePickUp.additionnalFireRate;
                    weapon.BulletAmountPerShot       *= FireRatePickUp.bulletPerShotMultiplier;
                    RangeWeaponGroup[characterEntity] = weapon;

                    entityCommandBuffer.DestroyEntity(entityB);
                }
            }
        }
 public void EquipRangeWeapon(RangeWeapon rw)
 {
     rangeWeapon = rw;
 }
示例#22
0
 public Shoot(BotFSM _stateMachine, RangeWeapon _weapon, Animator _animController)
 {
     stateMachine   = _stateMachine;
     weapon         = _weapon;
     animController = _animController;
 }