コード例 #1
0
        /// <summary>
        /// Toggles the active weapon as needed
        /// </summary>
        private void ToggleActiveWeapon()
        {
            if (input.Gnome.ToggleWeaponOne.phase == InputActionPhase.Performed)
            {
                activeWeapon = GnomeWeapons.FishingRod;
            }

            if (input.Gnome.ToggleWeaponTwo.phase == InputActionPhase.Performed)
            {
                activeWeapon = GnomeWeapons.Umbrella;
            }

            if (input.Gnome.ToggleWeaponThree.phase == InputActionPhase.Performed)
            {
                activeWeapon = GnomeWeapons.Firework;
            }

            // update the weapon stats
            if (weaponUI)
            {
                weaponUI.SendUpdatedWeaponStats();
            }
        }
コード例 #2
0
 /// <summary>
 /// Forces the UI to update even if the weapon has not changed.
 /// </summary>
 public void ForceWeaponUIUpdate()
 {
     lastWeapon   = activeWeapon;
     activeWeapon = gnome.GetActiveWeapon();
     shouldUpdate = true;
 }
コード例 #3
0
 /// <summary>
 /// Gets up to date values on the active weapon, should only be called when the user changes a weapon...
 /// </summary>
 public void SendUpdatedWeaponStats()
 {
     lastWeapon   = activeWeapon;
     activeWeapon = gnome.GetActiveWeapon();
 }
コード例 #4
0
 private void Start()
 {
     activeWeapon = gnome.GetActiveWeapon();
     UpdateWeapon(weapons[1]);
 }
コード例 #5
0
 /// <summary>
 /// Sets the active weapon to what is inputted
 /// </summary>
 /// <param name="newWeapon">GnomeWeapon to change to. (0 = none, 1 = rod, 2 = um, 3 = fire)</param>
 public void SetGnomeWeapon(int newWeapon)
 {
     activeWeapon = (GnomeWeapons)newWeapon;
 }