public void EquipItem(EquipSlot item) //Item item, Transform visualLocation). { if (item.visualLocation == null) { return; } foreach (Transform child in item.visualLocation) { GameObject.Destroy(child.gameObject); } if (item.EquipedItem.Mesh == null) { return; } GameObject meshInstance = Instantiate(item.EquipedItem.Mesh, item.visualLocation); meshInstance.transform.localPosition = item.offset; OffsetLocation offset = meshInstance.GetComponent <OffsetLocation>(); if (offset != null) { meshInstance.transform.localPosition += offset.postionOffset; meshInstance.transform.localRotation = Quaternion.Euler(offset.rotationOffset); meshInstance.transform.localScale = offset.scaleOffset; } }
public static void ReadOffsetLocation(this BinaryReader br, ref OffsetLocation offsetLoc) { offsetLoc = new OffsetLocation { Count = br.ReadInt32(), Offset = br.ReadInt32() }; }