Example #1
0
        public static Weapon get(WEAPON_TYPE wt)
        {
            switch (wt)
            {
/*                case WEAPON_STYLE.BOW:
 *                  break;*/
            case WEAPON_TYPE.WATER_FLASK:
                return(water);

            case WEAPON_TYPE.SWORD:
                return(sword);

            case WEAPON_TYPE.DAGGER:
                return(dagger);

            case WEAPON_TYPE.ICE_ARROW:
                return(ice_arrow);

/*                case WEAPON_STYLE.LIGHTNING:
 *                  break;
 *              case WEAPON_STYLE.SPIKE:
 *                  break;
 *              case WEAPON_STYLE.CLAWS:
 *                  break;
 *              case WEAPON_STYLE.FLAME:
 *                  break;*/
            }
            return(null);
        }
Example #2
0
 private void switchWeapon(WEAPON_TYPE type)
 {
     weaponsInventory[(int)weapon].SetActive(false);
     weapon = type;
     weaponsInventory[(int)weapon].SetActive(true);
     gameObject.GetComponent <PlayerMovment>().animator = weaponsInventory[(int)weapon].GetComponentInChildren <Animator>();
 }
Example #3
0
    /* Checks the curent values of each weapon stat and upgrades any weapon that meets a
    * specific criteria:
    *
    * The sum of a weapon's levels for damage, rate of fire, and ammo consumption must
    * be greater than or equal to 7.
    * For the damage upgrade, the damage level must be greater than or equal to 4 and greater than the rate of fire level,
    * for the speed upgrade the rate of fire level must be greater than or equal to 3 and greater than or equal to the damage level,
    * for any other case, the non focus upgrade is reached after a total of 7 levels. */
    public void updateWeapons()
    {
        /* Loop through all weapons. */
        for (WEAPON_TYPE idx = WEAPON_TYPE.sword; idx <= WEAPON_TYPE.grenade; ++idx)
        {
            WeaponStats weapon = stats.weapon_by_type(idx);
            // Verify that weapon has not already been upgraded
            if (weapon.upgrade_state() == 0)
            {
                // determine each of the weapon's stat's current level
                int dmg_lvl = weapon.weapon_stat(STAT_TYPE.damage).pointer_value();
                int rof_lvl = weapon.weapon_stat(STAT_TYPE.rate_of_fire).pointer_value();
                int ac_lvl  = weapon.weapon_stat(STAT_TYPE.ammo).pointer_value();
                // the sum of all three levels must greater than 7
                if ((dmg_lvl + rof_lvl + ac_lvl) >= 7)
                {
                    if (dmg_lvl >= 4)                       // damage focus upgrade
                    {
                        weapon.setUgrade(1);
                    }
                    else if (rof_lvl >= 3 && rof_lvl >= dmg_lvl)                         // speed focus upgrade
                    {
                        weapon.setUgrade(2);
                    }
                    else                         // no focus upgrade
                    {
                        weapon.setUgrade(3);
                    }
                }
            }
        }

        wep.updateWeapon();
    }
Example #4
0
	void Update()
	{
		int prevWeapon;

		// Switch between weapons.
		if (Input.GetKeyDown(KeyCode.F))
		{
			audio.PlayOneShot(switch_weapon_sound, 1.0f);
			prevWeapon = (int)current_weapon;
			current_weapon++;
			current_weapon = (WEAPON_TYPE)((int)current_weapon % NUM_WEAPONS);
			//CmdSetCurrentWeapon(prevWeapon, (int)current_weapon);
			SetCurrentWeaponScript((int)current_weapon);
		}

		if (Input.GetKeyDown(KeyCode.Alpha1) && current_weapon != (WEAPON_TYPE)0)
		{
			audio.PlayOneShot(switch_weapon_sound, 1.0f);
			prevWeapon = (int)current_weapon;
			current_weapon = (WEAPON_TYPE)0;
			//CmdSetCurrentWeapon(prevWeapon, (int)current_weapon);
			SetCurrentWeaponScript((int)current_weapon);
		}

		if (Input.GetKeyDown(KeyCode.Alpha2) && current_weapon != (WEAPON_TYPE)1)
		{
			audio.PlayOneShot(switch_weapon_sound, 1.0f);
			prevWeapon = (int)current_weapon;
			current_weapon = (WEAPON_TYPE)1;
			SetCurrentWeaponScript((int)current_weapon);
		}
	}
Example #5
0
    public static int GetAmmo(WEAPON_TYPE wType)
    {
        int output = 0;

        switch (wType)
        {
        case WEAPON_TYPE.ASSAULT:
            output = instance.assaultAmmo;
            break;

        case WEAPON_TYPE.SHOTGUN:
            output = instance.shotgunAmmo;
            break;

        case WEAPON_TYPE.SNIPER:
            output = instance.sniperAmmo;
            break;

        case WEAPON_TYPE.GRENADE_LAUNCHER:
            output = instance.grenadeAmmo;
            break;

        default:
            break;
        }
        return(output);
    }
Example #6
0
 /* Cycles to the next weapon base on the integer value associated with a weapon type. */
 public void cycle_weapons()
 {
     /* Checks all weapon slots for the next weapon owned, then sets held weaon to that
      * weapons not owned yet will not be cycled
      * the grenade is currently not implemented, so it is skipped. */
     held_weapon = (WEAPON_TYPE)(((byte)held_weapon + 1) % 4);
 }
Example #7
0
	/**
	 * Creates a weapon with the given type
	 */
	public WeaponStats(byte t) {
		type = (WEAPON_TYPE)t;
		state = 0;
		// currently there are only three stats
		stats = new Stat[3];
		initializeStats();
	}
    //得到武器类型(如果是非武器,返回WEAPON_TYPE_NONE)
    public ENUM_WEAPON_TYPE GetWeaponType()
    {
        WEAPON_TYPE nDefine = (WEAPON_TYPE)m_theBaseDef.nType;

        //转化为ENUM_WEAPON_TYPE
        switch (nDefine)
        {
        //case WTYPE_DAO:		return WEAPON_TYPE_LONG;
        case WEAPON_TYPE.WTYPE_QIANG:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_SPEAR);

        case WEAPON_TYPE.WTYPE_1DUAN:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_SHORT);

        case WEAPON_TYPE.WTYPE_2DUAN:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_DSHORT);

        case WEAPON_TYPE.WTYPE_BOW:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_BOW);

        case WEAPON_TYPE.WTYPE_STAFF:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_STAFF);

        default:
            return(ENUM_WEAPON_TYPE.WEAPON_TYPE_NONE);
        }
    }
Example #9
0
    void WeaponTypeStats(WEAPON_TYPE _type)
    {
        switch (_type)
        {
        case WEAPON_TYPE.SWORD:
        {
            attRange = 1;
        }
        break;

        case WEAPON_TYPE.CQC:
        {
            attRange = 1;
        }
        break;

        case WEAPON_TYPE.MAGIC:
        {
            attRange = 2;
        }
        break;

        case WEAPON_TYPE.SNIPER:
        {
            attRange = 3;
        }
        break;
        }
    }
Example #10
0
 /**
  * Creates a weapon with the given type
  */
 public WeaponStats(byte t)
 {
     type  = (WEAPON_TYPE)t;
     state = 0;
     // currently there are only three stats
     stats = new Stat[3];
     initializeStats();
 }
Example #11
0
 public bool SetRightWeapon(WEAPON_TYPE weapon)
 {
     if (weapon == currentLeftWeapon)
     {
         return(false);
     }
     currentRightWeapon = weapon;
     return(true);
 }
Example #12
0
 //System.Type _type )
 /// <summary>
 /// Returns the descriptor object of the given type
 /// </summary>
 /// <returns>The desc of type.</returns>
 /// <param name="_type">_type.</param>
 public WeaponDescriptor GetDescOfType( WEAPON_TYPE _weaponType )
 {
     WeaponDescriptor desc;
     if ( this.descriptorMap.TryGetValue( _weaponType, out desc ) == false )
     {
         DebugConsole.Error( "Could not find weapon descriptor for weapon type \"" + _weaponType + "\"", this );
         return null;
     }
     return desc;
 }
    public BulletDescriptor GetDescOfType( WEAPON_TYPE _weaponType )
    {
        BulletDescriptor desc = null;

        if ( this.descMap.TryGetValue( _weaponType, out desc ) == false )
        {
            DebugConsole.Error( "Could not find bullet descriptor of type " + _weaponType, this );
        }

        return desc;
    }
Example #14
0
 public PlayStage(ISoulBinder binder, IFishStage fish_stage, GamePlayerRecord money)
 {
     _Fishs         = new List <Fish>();
     _Bullets       = new List <Bullet>();
     _Requests      = new Dictionary <int, HitRequest>();
     _Binder        = binder;
     _FishStage     = fish_stage;
     _DeadFishCount = 0;
     _Money         = money;
     _WeaponType    = WEAPON_TYPE.NORMAL;
     _WeaponBet     = 10;
 }
Example #15
0
        public Weapon(WEAPON_TYPE p_WT)
        {
            WeaponTypeProp = p_WT;
            Random random = new Random();

            switch (WeaponTypeProp)
            {
            case WEAPON_TYPE.LIGHTNING:
                WeaponDamage            = random.Next(30, 40);
                EffectiveProtectionProp = PROTECTION_TYPE.PENDANT;
                break;

            case WEAPON_TYPE.WATER_FLASK:
                WeaponDamage = random.Next(10, 20);
                break;

            case WEAPON_TYPE.BOW:
                WeaponDamage            = random.Next(20, 30);
                EffectiveProtectionProp = PROTECTION_TYPE.MAGIC_HOOD;
                break;

            case WEAPON_TYPE.DAGGER:
                WeaponDamage = random.Next(10, 20);
                break;

            case WEAPON_TYPE.SWORD:
                WeaponDamage            = random.Next(10, 20);
                EffectiveProtectionProp = PROTECTION_TYPE.SHIELD;
                break;

            case WEAPON_TYPE.FLAME:
                WeaponDamage            = random.Next(30, 40);
                EffectiveProtectionProp = PROTECTION_TYPE.PENDANT;
                break;

            case WEAPON_TYPE.CLAWS:
                WeaponDamage            = random.Next(30, 40);
                EffectiveProtectionProp = PROTECTION_TYPE.SHIELD;
                break;

            case WEAPON_TYPE.SPIKE:
                WeaponDamage            = random.Next(30, 40);
                EffectiveProtectionProp = PROTECTION_TYPE.MAGIC_HOOD;
                break;

            case WEAPON_TYPE.ICE_ARROW:
                WeaponDamage = random.Next(10, 20);
                break;

            default:
                break;
            }
        }
Example #16
0
 public PlayStage(ISoulBinder binder, IFishStage fish_stage, GamePlayerRecord money)
 {
     _Fishs = new List<Fish>();
     _Bullets = new List<Bullet>();
     _Requests = new Dictionary<int, HitRequest>();
     _Binder = binder;
     _FishStage = fish_stage;
     _DeadFishCount = 0;
     _Money = money;
     _WeaponType = WEAPON_TYPE.NORMAL;
     _WeaponBet = 10;
 }
Example #17
0
    private int _Find(WEAPON_TYPE bullet)
    {
        if (bullet == WEAPON_TYPE.NORMAL)
        {
            return(1);
        }
        if (bullet == WEAPON_TYPE.FREE_POWER)
        {
            return(2);
        }

        return(1);
    }
Example #18
0
    // Use this for initialization
    void Start()
    {
        weapon = WEAPON_TYPE.GUN;
        ammoInvenotry.Add(AMMO_TYPE.SHOTGUNAMMO, 10);
        ammoInvenotry.Add(AMMO_TYPE.GUNAMMO, 15);
        ammoInvenotry.Add(AMMO_TYPE.RIFLEAMMO, 35);

        weaponsCarrying = new bool[(int)WEAPON_TYPE.TOTAL_WEAPONS];
        weaponsCarrying[(int)WEAPON_TYPE.GUN]              = true;
        weaponsCarrying[(int)WEAPON_TYPE.SHOTGUN]          = true;
        weaponsCarrying[(int)WEAPON_TYPE.RIFLE]            = true;
        gameObject.GetComponent <PlayerMovment>().animator = weaponsInventory[(int)weapon].GetComponentInChildren <Animator>();
    }
Example #19
0
    public Player_Stats()
    {
        int[]       val_temp  = new int[11];
        Stat_Cost[] cost_temp = new Stat_Cost[10];
        // initialize health values
        for (int idx = 0; idx < val_temp.Length; ++idx)
        {
            val_temp[idx] = (int)(1.5f * idx * idx) + 8 * idx + 5;
        }
        // initialize stat costs
        for (int idx = 0; idx < cost_temp.Length; ++idx)
        {
            cost_temp[idx] = new Stat_Cost(0, (int)(0.35f * idx * idx) + 9 * idx + 6);
        }

        MAX_HEALTH = new Stat(STAT_TYPE.health, val_temp, cost_temp);
        health     = (int)MAX_HEALTH.current();
        HP_raised  = true;

        val_temp  = new int[11];
        cost_temp = new Stat_Cost[10];
        // initialize shield values
        for (int idx = 0; idx < val_temp.Length; ++idx)
        {
            val_temp[idx] = (int)(0.55f * idx * idx) + 5 * idx + 3;
        }

        // initialize stat costs
        for (int idx = 0; idx < cost_temp.Length; ++idx)
        {
            cost_temp[idx] = new Stat_Cost((int)(0.19f * idx * idx) + 2 * idx + 3, 0);
        }

        MAX_SHIELD    = new Stat(STAT_TYPE.shield, val_temp, cost_temp);
        shield        = (int)MAX_SHIELD.current();
        Shield_raised = true;

        WEAPONS     = new WeaponStats[4];
        WEAPONS[0]  = new WeaponStats(0);
        WEAPONS[1]  = new WeaponStats(1);
        WEAPONS[2]  = new WeaponStats(2);
        WEAPONS[3]  = new WeaponStats(3);
        held_weapon = WEAPON_TYPE.sword;

        scrap       = 0;   //2573
        energyCores = 0;   //1197

        MEDPACKS = new Stat(STAT_TYPE.other, new int[] { 0, 1, 2, 3 },
                            new Stat_Cost[] { new Stat_Cost(1, 5), new Stat_Cost(3, 18), new Stat_Cost(5, 43) });
    }
Example #20
0
        /// <summary>
        /// 現在の武器の種類の取得
        /// </summary>
        void GetWeaponType()
        {
            // 前フレームの銃の種類を保存
            oldWeaponType_ = weaponType_;

            if (player_.IsSpecialWeapon)
            {
                weaponType_ = player_.WeaponList[2].GetWeaponType;
            }
            else
            {
                weaponType_ = WEAPON_TYPE.HANDGUN;
            }
        }
Example #21
0
    public Weapon getWeapon(WEAPON_TYPE type)
    {
        Weapon output = null;

        foreach (Weapon w in weaponList)
        {
            if (w.type == type)
            {
                output = w;
                break;
            }
        }

        return(output);
    }
Example #22
0
    /* Returns the stats of the weapon with the given type.
     * See Enumerations class for valid values for parameter t. */
    public WeaponStats weapon_by_type(WEAPON_TYPE t)
    {
        switch (t)
        {
        case WEAPON_TYPE.sword:         return(WEAPONS[0]);

        case WEAPON_TYPE.rifle:         return(WEAPONS[1]);

        case WEAPON_TYPE.shotgun:       return(WEAPONS[2]);

        case WEAPON_TYPE.grenade:       return(WEAPONS[3]);

        default:                                        return(null);
        }
    }
Example #23
0
    /// <summary>
    /// Lookup a weapon's upgrade location based on the inspector values
    /// </summary>
    /// <param name="weaponType">Type of weapon to look up</param>
    /// <returns>upgrade location of the weapon</returns>
    public Vector3 GetWeaponLocation(WEAPON_TYPE weaponType)
    {
        // loop through each weapon property set in the inspector
        foreach (WeaponProperties wp in weaponProperties)
        {
            if (wp.weaponType == weaponType)
            {
                // this is the weapon we are looking for, so we return the location

                return(wp.location);
            }
        }

        // no weapon found in the property listing, so we return origin
        return(Vector3.zero);
    }
Example #24
0
    public Weapon GetWeapon(WEAPON_TYPE type)
    {
        InitializeWeaponList();
        Weapon output = null;

        foreach (Weapon w in weaponList)
        {
            if (w.type == type)
            {
                output = w;
                break;
            }
        }

        return(output);
    }
Example #25
0
    /// <summary>
    /// Lookup a weapon's damage based on the inspector values
    /// </summary>
    /// <param name="weaponType">Type of weapon to look up</param>
    /// <returns>Damage value of the weapon</returns>
    public float GetWeaponDamage(WEAPON_TYPE weaponType)
    {
        // loop through each weapon property set in the inspector
        foreach (WeaponProperties wp in weaponProperties)
        {
            if (wp.weaponType == weaponType)
            {
                // this is the weapon we are looking for, so we return the damage

                return(wp.damage);
            }
        }

        // no weapon found in the property listing, so we return no damage
        return(0);
    }
Example #26
0
    public void SwitchWeapons(WEAPON_TYPE type)
    {
        currentWeapon.enabled = false;

        foreach (Weapon w in weaponList)
        {
            if (type == w.type)
            {
                animator.SetTrigger("SwitchWeapons");
                animator.SetInteger("Weapon", (int)type);
                currentWeapon         = w;
                currentWeapon.enabled = true;
                break;
            }
        }
    }
Example #27
0
    public override TASK_RETURN_STATUS Run(Survivor_AI sAI)
    {
        TASK_RETURN_STATUS output = TASK_RETURN_STATUS.FAILED;

        WEAPON_TYPE prevType = sAI.GetSurvivor().GetCurrentWeapon().type;

        sAI.GetSurvivor().SwitchWeapons(WEAPON_TYPE.GRENADE_LAUNCHER);
        if (sAI.GetSurvivor().GetCurrentWeapon().getAmmo() > 0)
        {
            Enemy target = sAI.GetBlackboard().enemyTarget;
            sAI.GetSurvivor().Fire(target.transform.position + (sAI.GetEnemyHeightOffset() * Vector3.up));
            sAI.GetSurvivor().SwitchWeapons(prevType);
            output = TASK_RETURN_STATUS.SUCCEED;
        }
        return(output);
    }
Example #28
0
	public Player_Stats() {
		int[] val_temp = new int[11];
		Stat_Cost[] cost_temp = new Stat_Cost[10];
		// initialize health values
		for (int idx = 0; idx < val_temp.Length; ++idx) {
			val_temp[idx] = (int)(1.5f * idx * idx) + 8 * idx + 5;
		}
		// initialize stat costs
		for (int idx = 0; idx < cost_temp.Length; ++idx) {
			cost_temp[idx] = new Stat_Cost(0, (int)(0.35f * idx * idx) + 9 * idx + 6);

		}

		MAX_HEALTH = new Stat(STAT_TYPE.health, val_temp, cost_temp);
		health = (int)MAX_HEALTH.current();
		HP_raised = true;

		val_temp = new int[11];
		cost_temp = new Stat_Cost[10];
		// initialize shield values
		for (int idx = 0; idx < val_temp.Length; ++idx) {
			val_temp[idx] = (int)(0.55f * idx * idx) + 5 * idx + 3;
		}

		// initialize stat costs
		for (int idx = 0; idx < cost_temp.Length; ++idx) {
			cost_temp[idx] = new Stat_Cost((int)(0.19f * idx * idx) + 2 * idx + 3, 0);
		}

		MAX_SHIELD = new Stat(STAT_TYPE.shield, val_temp, cost_temp);
		shield = (int)MAX_SHIELD.current();
		Shield_raised = true;

		WEAPONS = new WeaponStats[4];
		WEAPONS[0] = new WeaponStats(0);
		WEAPONS[1] = new WeaponStats(1);
		WEAPONS[2] = new WeaponStats(2);
		WEAPONS[3] = new WeaponStats(3);
		held_weapon = WEAPON_TYPE.sword;

		scrap = 0; //2573
		energyCores = 0; //1197

		MEDPACKS = new Stat(STAT_TYPE.other, new int[] { 0, 1, 2, 3 },
											 new Stat_Cost[] { new Stat_Cost(1, 5), new Stat_Cost(3, 18), new Stat_Cost(5, 43) } );

	}
Example #29
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.collider.tag == "Ground")
        {
            elMeuAnimator.SetBool("Jump", false);
        }

        if (collision.collider.tag == "PickUp_Weapon")
        {
            current_weapon = WEAPON_TYPE.TYPE_02;

            PrefabProyectile.gameObject.GetComponent <Projectile>().speedProjectile = 100.0f;
            PrefabProyectile.gameObject.GetComponent <Animator>().SetBool("Activate_Weapon_02", true);
            Debug.Log(PrefabProyectile.gameObject.GetComponent <Animator>().GetBool("Activate_Weapon_02"));

            Destroy(collision.gameObject);
        }
    }
 void TryApplyingWeapon(WEAPON_TYPE weapon, bool isLeftWeapon)
 {
     if (isLeftWeapon)
     {
         if (weaponScript.SetLeftWeapon(weapon))
         {
             draggedWeapon.position = leftWeaponSlot.position;
             IsChosen = true;
         }
     }
     else
     {
         if (weaponScript.SetRightWeapon(weapon))
         {
             draggedWeapon.position = rightWeaponSlot.position;
             IsChosen = true;
         }
     }
 }
    //------------------------------------------------
    //Equip weapon
    public bool Equip(WEAPON_TYPE WeaponType)
    {
        //If not this type, then exit and no equip
        if((WeaponType != Type) || (!Collected) || (Ammo == 0) || (IsEquipped)) return false;

        //Is this weapon. So equip
        IsEquipped = true;

        //Show default sprite
        DefaultSprite.enabled = true;

        //Activate Can Fire
        CanFire = true;

        //Send weapon change event
        GameManager.Notifications.PostNotification(this, "WeaponChange");

        //Weapon was equipped
        return true;
    }
Example #32
0
    public WEAPON_TYPE GetWeaponForAmmo(AmmoPickup ammo)
    {
        WEAPON_TYPE weapon = WEAPON_TYPE.NULL;

        switch (ammo.getAmmoType())
        {
        case AMMOTYPE.ASSAULT:
            weapon = WEAPON_TYPE.ASSAULT;
            break;

        case AMMOTYPE.SHOTGUN:
            weapon = WEAPON_TYPE.SHOTGUN;
            break;

        case AMMOTYPE.GRENADE:
            weapon = WEAPON_TYPE.GRENADE;
            break;
        }

        return(weapon);
    }
Example #33
0
    public void SwitchWeapons(WEAPON_TYPE type)
    {
        InitializeWeaponList();

        if (state == SURVIVORSTATE.NORMAL)
        {
            if (switchWeaponTimer <= 0)
            {
                switchWeaponTimer = 0.25f;
                currentWeapon.DisableWeapon();

                foreach (Weapon w in weaponList)
                {
                    if (type == w.type)
                    {
                        currentWeapon = w;
                        currentWeapon.EnableWeapon();
                        break;
                    }
                }
            }
        }
    }
Example #34
0
    void SetProjectileProperties(Transform trans, WEAPON_TYPE weaponType)
    {
        float scaleToUse = 0;

        switch (weaponType)
        {
        case WEAPON_TYPE.RAILGUN:
            scaleToUse = 0.85f;
            break;

        case WEAPON_TYPE.MISSILE:
            scaleToUse = 1.0f;
            break;

        case WEAPON_TYPE.BOMBS:
            scaleToUse = 0.7f;
            break;

        default:
            break;
        }
        trans.localScale = new Vector3(scaleToUse, scaleToUse, scaleToUse);
    }
Example #35
0
    public static void PurchaseAmmo(WEAPON_TYPE wType)
    {
        if (GameManager.isBreakInProgress())
        {
            switch (wType)
            {
            case WEAPON_TYPE.ASSAULT:
                instance.PurchaseAmmo(ref instance.assaultAmmo, instance.assualtAmmoCost, instance.assualtAmmoPerPurchase);
                break;

            case WEAPON_TYPE.SHOTGUN:
                instance.PurchaseAmmo(ref instance.shotgunAmmo, instance.shotgunAmmoCost, instance.shotgunAmmoPerPurchase);
                break;

            case WEAPON_TYPE.SNIPER:
                instance.PurchaseAmmo(ref instance.sniperAmmo, instance.sniperAmmoCost, instance.sniperAmmoPerPurchase);
                break;

            default:
                break;
            }
        }
    }
    //------------------------------------------------
    //Equip weapon
    public bool Equip(WEAPON_TYPE WeaponType)
    {
        //If not this type, then exit and no equip
        if ((WeaponType != Type) || (!Collected) || (Ammo == 0) || (IsEquipped))
        {
            return(false);
        }

        //Is this weapon. So equip
        IsEquipped = true;

        //Show default sprite
        DefaultSprite.enabled = true;

        //Activate Can Fire
        CanFire = true;

        //Send weapon change event
        //GameManager.Notifications.PostNotification(this, "WeaponChange");

        //Weapon was equipped
        return(true);
    }
Example #37
0
    private void AddAmmo(WEAPON_TYPE wEAPON_TYPE, int amount)
    {
        switch (wEAPON_TYPE)
        {
        case WEAPON_TYPE.ASSAULT:
            instance.assaultAmmo += amount;
            break;

        case WEAPON_TYPE.SHOTGUN:
            instance.shotgunAmmo += amount;
            break;

        case WEAPON_TYPE.SNIPER:
            instance.sniperAmmo += amount;
            break;

        case WEAPON_TYPE.GRENADE_LAUNCHER:
            instance.grenadeAmmo += amount;
            break;

        default:
            break;
        }
    }
Example #38
0
    /// <summary>
    /// Lookup a weapon's upgrade location based on the inspector values
    /// </summary>
    /// <param name="weaponType">Type of weapon to look up</param>
    /// <returns>upgrade location of the weapon</returns>
    public Vector3 GetWeaponLocation(WEAPON_TYPE weaponType)
    {
        // loop through each weapon property set in the inspector
        foreach (ROTD_WeaponProperties wp in weaponProperties)
        {
            if (wp.weaponType == weaponType)
            {
                // this is the weapon we are looking for, so we return the location

                return wp.location;
            }
        }

        // no weapon found in the property listing, so we return origin
        return Vector3.zero;
    }
Example #39
0
    public void OnDisableDumbBulletMessage( WEAPON_TYPE _weaponType, int _index, Vector3 _bulletPosition )
    {
        BulletBase bulletScript = this.bulletDictionary[_weaponType].GetAvailableBullet( _index, -1 );

        if ( bulletScript.desc.fadeOut > 0.0f )
        {
            bulletScript.transform.position = _bulletPosition;
            bulletScript.OnFadeBegin();
        }
        else
        {
            bulletScript.gameObject.SetActive( false );
            bulletScript.state = BulletBase.BULLET_STATE.INACTIVE;
        }
    }
 public WeaponRate(WEAPON_TYPE weapon_type, int rate)
 {
     WeaponType = weapon_type;
     Rate = rate;
 }
 public WeaponPower(WEAPON_TYPE weapon_type, int power)
 {
     WeaponType = weapon_type;
     Power = power;
 }
Example #42
0
 public void SendDestroyDumbBulletMessage( WEAPON_TYPE _weaponType, int _index, Vector3 _bulletPosition )
 {
     this.GetComponent<NetworkView>().RPC( "OnDestroyDumbBulletRPC", RPCMode.Others, (int)_weaponType, _index, _bulletPosition );
 }
Example #43
0
    /// <summary>
    /// Lookup a weapon's damage based on the inspector values
    /// </summary>
    /// <param name="weaponType">Type of weapon to look up</param>
    /// <returns>Damage value of the weapon</returns>
    public float GetWeaponDamage(WEAPON_TYPE weaponType)
    {
        // loop through each weapon property set in the inspector
        foreach (ROTD_WeaponProperties wp in weaponProperties)
        {
            if (wp.weaponType == weaponType)
            {
                // this is the weapon we are looking for, so we return the damage

                return wp.damage;
            }
        }

        // no weapon found in the property listing, so we return no damage
        return 0;
    }
Example #44
0
	/* Switches player's currently weapon to the given weapon. */
	public void switch_weapon_to(WEAPON_TYPE w) { held_weapon = w; }
Example #45
0
 void IPlayer.EquipWeapon(WEAPON_TYPE weapon_type, int odds)
 {
     _WeaponType = weapon_type;
     _WeaponBet = odds;
 }
Example #46
0
	/* Returns the stats of the weapon with the given type.
	 * See Enumerations class for valid values for parameter t. */
	public WeaponStats weapon_by_type(WEAPON_TYPE t) {
		switch (t) {
			case WEAPON_TYPE.sword:		return WEAPONS[0];
			case WEAPON_TYPE.rifle:		return WEAPONS[1];
			case WEAPON_TYPE.shotgun:	return WEAPONS[2];
			case WEAPON_TYPE.grenade:	return WEAPONS[3];
			default: 					return null;	
		}
	}
Example #47
0
    /// <summary>
    /// Called by the network manager to create a dumb local bullet, until it is destroyed by a similar call
    /// </summary>
    /// <param name="_ownerID">The owner of the bullet</param>
    /// <param name="_creationTime">_creation time.</param>
    /// <param name="_bulletType">_bullet type.</param>
    /// <param name="_index">_index.</param>
    /// <param name="_position">_position.</param>
    /// <param name="_forward">The forward direction of the bullet</param>
    public void CreateBulletRPC( int _ownerID, float _creationTime, WEAPON_TYPE _weaponType, int _index, Vector3 _position, Quaternion _rot )
    {
        BulletBase bulletScript = this.bulletDictionary[_weaponType].GetAvailableBullet( _index, _ownerID );

        bulletScript.Reset();
        bulletScript.state = BulletBase.BULLET_STATE.ACTIVE_NOT_OWNED;

        GameObject bulletObj = bulletScript.gameObject;
        bulletObj.SetActive( true );
        bulletObj.transform.position = _position;
        bulletObj.transform.rotation = _rot;

        if ( bulletScript.desc.smartBullet == false )
        {
            bulletObj.GetComponent<Collider>().enabled = false;

            float delta = (float)Network.time - _creationTime;
            Vector3 offset = bulletObj.transform.forward * bulletScript.desc.moveSpeed * delta;
            bulletObj.transform.Translate( offset );
        }
        bulletScript.OnShoot();
    }
Example #48
0
	/* Cycles to the next weapon base on the integer value associated with a weapon type. */
	public void cycle_weapons() {
		
		/* Checks all weapon slots for the next weapon owned, then sets held weaon to that
		 * weapons not owned yet will not be cycled
		 * the grenade is currently not implemented, so it is skipped. */
		held_weapon = (WEAPON_TYPE)(((byte)held_weapon + 1) % 4);
	}
Example #49
0
 public TreasureRecord(WEAPON_TYPE type)
 {
     WeaponType = type;
     Count = 0;
 }
Example #50
0
 public void SetWeaponType( WEAPON_TYPE _weaponType )
 {
     this.weaponType = _weaponType;
     this.InitialiseDescriptors();
 }
Example #51
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="WeaponHitRecord" /> class.
 /// </summary>
 public WeaponHitRecord(WEAPON_TYPE weapon_type)
 {
     WeaponType = weapon_type;
     FishKills = new FishKillRecord[0];
 }