Esempio n. 1
0
        protected void SetupEquipWeapons(EquipWeapons equipWeapons)
        {
            mustReleaseFireKey      = false;
            currentCrosshairSetting = PlayerCharacterEntity.GetCrosshairSetting();

            rightHandWeapon = equipWeapons.rightHand.GetWeaponItem();
            leftHandWeapon  = equipWeapons.leftHand.GetWeaponItem();
            // Weapon ability will be able to use when equip weapon at main-hand only
            if (rightHandWeapon != null && leftHandWeapon == null)
            {
                if (rightHandWeapon.weaponAbility != weaponAbility)
                {
                    if (weaponAbility != null)
                    {
                        weaponAbility.ForceDeactivated();
                    }
                    weaponAbility = rightHandWeapon.weaponAbility;
                    weaponAbility.Setup(this);
                    weaponAbilityState = WeaponAbilityState.Deactivated;
                }
            }
            else
            {
                if (weaponAbility != null)
                {
                    weaponAbility.ForceDeactivated();
                }
                weaponAbility      = null;
                weaponAbilityState = WeaponAbilityState.Deactivated;
            }
        }
Esempio n. 2
0
        private void UpdateCrosshair(CrosshairSetting setting, float power)
        {
            if (crosshairRect == null)
            {
                return;
            }

            crosshairRect.gameObject.SetActive(!setting.hidden);
            currentCrosshairSize = crosshairRect.sizeDelta;
            // Change crosshair size by power
            currentCrosshairSize.x += power;
            currentCrosshairSize.y += power;
            // Set crosshair size
            crosshairRect.sizeDelta = new Vector2(Mathf.Clamp(currentCrosshairSize.x, setting.minSpread, setting.maxSpread), Mathf.Clamp(currentCrosshairSize.y, setting.minSpread, setting.maxSpread));
        }