public HorseItem Get(HorseItem.Type type, bool verbose = true) { if (horseDictionary.ContainsKey(type)) { return(horseDictionary[type]); } if (verbose) { Debug.LogError("Arsenal : body dictionary doesn't contain item " + type.ToString()); } return(null); }
public GameObject GetPickable(HorseItem.Type type, bool showName = false, bool destroyOnPick = true) { HorseItem item = Get(type); if (!item) { return(null); } GameObject go = Instantiate(pickablePrefab.gameObject); go.name = type.ToString(); go.transform.parent = null; go.transform.position = Vector3.zero; go.transform.localRotation = Quaternion.identity; go.transform.localScale = Vector3.one; go.AddComponent <InteractionType>().type = InteractionType.Type.pickableHorse; HorseItem.Copy(item, go.AddComponent <HorseItem>()); go.SetActive(true); SkinnedMeshRenderer skin = item.gameObject.GetComponent <SkinnedMeshRenderer>(); SpecialPickableShopArsenal pickable = go.GetComponent <SpecialPickableShopArsenal>(); pickable.textmesh.text = go.name; if (go.name.Length >= 8) { pickable.textmesh.characterSize *= 0.5f; } pickable.itemMesh.gameObject.SetActive(false); pickable.body.gameObject.SetActive(false); pickable.horse.gameObject.SetActive(true); if (skin) { BodySlot.CopySkinnedMesh(skin, pickable.horse); } else { pickable.horse.gameObject.SetActive(false); } pickable.textmesh.gameObject.SetActive(showName); go.GetComponent <Item>().destroyOnPick = destroyOnPick; return(go); }