public void Attach(WeaponPartLocation partLocation, object partObj, object weaponObj) { var partGo = partObj as GameObject; var weaponGo = weaponObj as GameObject; #if !UnitTest if (Logger.IsDebugEnabled) { Logger.DebugFormat("attach {0} to {1} in {2}", partGo.name, weaponGo.name, partLocation); } #endif if (partLocation != WeaponPartLocation.EndOfTheWorld) { _boneMount.MountWeaponAttachment(partGo, weaponGo, partLocation); } else { #if !UnitTest Logger.ErrorFormat("Location is illegal with item location {0}", partLocation); #endif } ShowWeapon(weaponGo); }
public void MountWeaponAttachment(GameObject attachment, GameObject weapon, WeaponPartLocation location) { if (attachment != null && weapon != null) { if (weapon.GetComponent <TransformCache>() == null) { BoneTool.CacheTransform(weapon); } if (attachment.GetComponent <TransformCache>() == null) { BoneTool.CacheTransform(attachment); } if (_attachmentLocator.ContainsKey(location)) { var anchor = FindChildBoneFromCache(attachment, BoneName.AttachmentLocator, false); var target = FindChildBoneFromCache(weapon, _attachmentLocator[location], false); FixedObj2Bones(attachment, anchor, target); } else { _logger.WarnFormat("Wrong Attachment Location: {0}", location); } } }
public static void RefreshWeaponPartModels(ICharacterAppearance appearance, int weaponId, WeaponPartsStruct oldParts, WeaponPartsStruct parts, EWeaponSlotType slot) { var weaponConfig = SingletonManager.Get <WeaponResourceConfigManager>().GetConfigById(weaponId); if (null == weaponConfig) { return; } if (!((EWeaponType_Config)weaponConfig.Type).MayHasPart()) { Logger.WarnFormat("weapon type {0} has no attachment by default ", weaponConfig.Type); return; } var pos = slot.ToWeaponInPackage(); // var oldArr = oldParts.ToAniLocation(); var newArr = parts.ToAniLocation(); for (WeaponPartLocation tmp = WeaponPartLocation.None + 1; tmp < WeaponPartLocation.EndOfTheWorld; tmp++) { if (newArr[(int)tmp] > 0) { appearance.MountAttachment(pos, tmp, newArr[(int)tmp]); } else { appearance.UnmountAttachment(pos, tmp); } } }
protected AttachmentParamData(bool isFirstPersonClass, WeaponPartLocation attachmentType, WeaponInPackage weaponType) { _isFirstPersonClass = isFirstPersonClass; AttachmentType = attachmentType; _weaponType = weaponType; Init(); }
public void UnmountAttachment(WeaponInPackage pos, WeaponPartLocation location) { if ((int)pos <= (int)WeaponInPackage.EndOfTheWorld && (int)location <= (int)WeaponPartLocation.EndOfTheWorld) { _weaponController.UnmountAttachment(pos, location); } }
public void MountAttachment(WeaponInPackage pos, WeaponPartLocation location, int id) { if ((int)pos <= (int)WeaponInPackage.EndOfTheWorld && (int)location <= (int)WeaponPartLocation.EndOfTheWorld) { WeaponControllerBaseImpl.MountAttachment(pos, location, id); } }
public void UnmountAttachment(WeaponInPackage pos, WeaponPartLocation location) { if ((int)pos <= (int)WeaponInPackage.EndOfTheWorld && (int)location <= (int)WeaponPartLocation.EndOfTheWorld) { WeaponDataBaseImpl.UnmountAttachment(pos, location); } }
public void SetChangeAttachment(Action <WeaponInPackage, WeaponPartLocation, int> action, WeaponInPackage pos, WeaponPartLocation location, int id) { _changeWeaponAttachment = action; _weaponPosition = pos; _attachmentLocation = location; _attachment = id; }
public void LoadPart(AssetInfo asset, WeaponPartLocation location) { #if !UnitTest if (Logger.IsDebugEnabled) { Logger.DebugFormat("LoadPart {0} in {1}", asset, location); } #endif _partAssetDic[location] = asset; _weaponModelLoader.LoadAsset(asset); }
private void OnPartLoaded(T go, WeaponPartLocation partType) { _partGoDic[partType] = go; if (null != _weaponGo) { Attach(partType, go, _weaponGo); } else { _waitPartGoDic[partType] = go; } }
private void OnPartLoaded(T go, WeaponPartLocation partType) { BoneTool.CacheTransform(go as GameObject); _partGoDic[partType] = go; if (null != _weaponGo) { Attach(partType, go, _weaponGo); } else { _waitPartGoDic[partType] = go; } if (partType.Equals(WeaponPartLocation.Scope)) { _weaponModelAssemblyController.RefreshRemovableAttachment(_weaponGo as GameObject, true); } }
private void UpdateAttachmentType(WeaponInPackage pos, WeaponPartLocation location, int type) { if (WeaponInPackage.PrimaryWeaponOne != pos && WeaponInPackage.PrimaryWeaponTwo != pos && WeaponInPackage.SideArm != pos) { return; } AssertUtility.Assert( (int)WeaponPartLocation.EndOfTheWorld * 3 + (int)WeaponInPackage.EndOfTheWorld - 1 == _latestWeaponValue.Length - 1, "Add New WeaponPartLocation Or WeaponInPackage Enum"); var index = GetIndexFromPos(pos) + (int)location + 1; if (index < 0 || index >= _latestWeaponValue.Length) { return; } _latestWeaponValue[index] = type; }
protected void SetAttachmentIdByType(WeaponInPackage weaponType, WeaponPartLocation attachmentType, int attachmentId) { _weaponDataController.SetAttachmentIdByType(weaponType, attachmentType, attachmentId); }
public void SetAttachmentIdByType(WeaponInPackage weaponType, WeaponPartLocation attachmentType, int id) { _attachmentIds[(int)weaponType, (int)attachmentType] = id; }
private void UnmountAttachmentImpl(WeaponInPackage pos, WeaponPartLocation location, int type) { UpdateAttachmentType(pos, location, type); }
public int GetAttachmentId(WeaponPartLocation attachmentType, WeaponInPackage weaponType) { return(_weapons[(int)weaponType].GetAttachmentId(attachmentType)); }
private void MountAttachmentImpl(WeaponInPackage pos, WeaponPartLocation location, int attachmentId) { UpdateAttachmentType(pos, location, attachmentId); }
public int GetAttachmentId(WeaponPartLocation type) { return(Attachment.GetAttachmentIdByType(type)); }
public GameObject GetAttachmentObjByType(WeaponPartLocation type) { return(_attachments[(int)type].GetAttachmentObj()); }
public int GetAttachmentIdByType(WeaponPartLocation type) { return(_attachments[(int)type].GetAttachmentId()); }
public void Attach(WeaponPartLocation partLocation, T partGo, T weaponGo) { _weaponModelAssemblyController.Attach(partLocation, partGo, weaponGo); }
public void MountAttachment(WeaponInPackage pos, WeaponPartLocation location, int id) { var cmd = GetAvailableCommand(); cmd.SetChangeAttachment(MountAttachmentImpl, pos, location, id); }
public AttachmentParam(bool isFirstPersonClass, WeaponPartLocation attachmentType, WeaponInPackage weaponType) : base(isFirstPersonClass, attachmentType, weaponType) { WeaponLoadAssetHandler = new WeaponLoadAssetHandler(AttachmentAssetLoadSuccess); }
public void UnmountAttachment(WeaponInPackage pos, WeaponPartLocation location) { var cmd = GetAvailableCommand(); cmd.SetChangeAttachment(UnmountAttachmentImpl, pos, location, UniversalConsts.InvalidIntId); }