} // TO activate #endregion #region ClassLifeCycles public InventoryService(Contexts contexts) : base(contexts) { Clothes.Add(BodyParts.Head, null); Clothes.Add(BodyParts.Torso, Data.Jacket); Clothes.Add(BodyParts.Arms, null); Clothes.Add(BodyParts.Hips, null); Clothes.Add(BodyParts.Legs, null); Clothes.Add(BodyParts.Feet, null); Feast = Data.Feast; }
public void PlayBattleIdleAnimation(WeaponItem leftWeapon, WeaponItem rightWeapon) { // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! to refactor if (leftWeapon.WeaponHandType == WeaponHandType.TwoHanded && leftWeapon.WeaponType == WeaponType.MeleeCutting) { CharacterAnimator.Play(_battleIdleTwoHandedSliceHash); } else { CharacterAnimator.Play(_battleIdleHash); } }
public void SetWeaponInRightHand(CharacterModel characterModel, WeaponItem weapon, out WeaponHitBoxBehavior weaponHitBox) { WeaponHitBoxBehavior weaponHitBoxBehaviour = null; if (weapon.WeaponHandType == WeaponHandType.TwoHanded) { if (characterModel.RightHandWeaponObject == null) { characterModel.RightHandWeapon = weapon; characterModel.LeftHandWeapon = weapon; characterModel.RightHandWeaponObject = GameObject.Instantiate(weapon.WeaponPrefab); characterModel.RightHandWeaponObject.transform.SetParent(characterModel.RightHand); characterModel.RightHandWeaponObject.transform.localPosition = weapon.PrefabPositionInHand; characterModel.RightHandWeaponObject.transform.localEulerAngles = weapon.PrefabRotationInHand; weaponHitBoxBehaviour = characterModel.RightHandWeaponObject.GetComponent <WeaponHitBoxBehavior>(); weaponHitBoxBehaviour.IsInteractable = false; } else { if (characterModel.RightHandWeapon.WeaponHandType == WeaponHandType.TwoHanded) { // set weapon } else { // set another arm free } } } else { if (characterModel.RightHandWeaponObject == null) { characterModel.RightHandWeapon = weapon; characterModel.RightHandWeaponObject = GameObject.Instantiate(weapon.WeaponPrefab); characterModel.RightHandWeaponObject.transform.SetParent(characterModel.RightHand); characterModel.RightHandWeaponObject.transform.localPosition = weapon.PrefabPositionInHand; characterModel.RightHandWeaponObject.transform.localEulerAngles = weapon.PrefabRotationInHand; weaponHitBoxBehaviour = characterModel.RightHandWeaponObject.GetComponent <WeaponHitBoxBehavior>(); weaponHitBoxBehaviour.IsInteractable = false; } else { } // set in current arm } weaponHitBox = weaponHitBoxBehaviour; }
public void PlayRollAnimation(float rollingX, float rollingY, WeaponItem leftWeapon, WeaponItem rightWeapon) { CharacterAnimator.SetFloat("RollingX", rollingX); CharacterAnimator.SetFloat("RollingY", rollingY); // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! to refactor if (leftWeapon.WeaponHandType == WeaponHandType.TwoHanded && leftWeapon.WeaponType == WeaponType.MeleeCutting) { CharacterAnimator.Play(_rollTwoHandedSliceHash); } else { CharacterAnimator.Play(_rollHash); } }
private void SetLeftWeapon(WeaponItem newWeapon) { if (newWeapon.WeaponHandType == WeaponHandType.OneHanded) { if (_characterModel.LeftWeaponBehavior != null) { _characterModel.LeftWeaponBehavior.OnFilterHandler -= OnHitBoxFilter; _characterModel.LeftWeaponBehavior.OnTriggerEnterHandler -= OnLeftHitBoxHit; } _services.InventoryService.SetWeaponInLeftHand(_characterModel, newWeapon, out WeaponHitBoxBehavior newBehaviour); _characterModel.LeftWeaponBehavior = newBehaviour; _characterModel.LeftWeaponBehavior.OnFilterHandler += OnHitBoxFilter; _characterModel.LeftWeaponBehavior.OnTriggerEnterHandler += OnLeftHitBoxHit; } else { // if two handed } }
public WeaponItem[] GetWeapons() { if (HasWeapons) { WeaponItem[] weaponItems = new WeaponItem[WeaponQuantity]; int enumerator = 0; foreach (var pocket in PocketInfos) { if (pocket.ItemInPocket.ItemStruct.ItemType == ItemType.Weapon) { weaponItems[enumerator] = pocket.ItemInPocket as WeaponItem; enumerator++; } } return(weaponItems); } else { return(new WeaponItem[0]); } }