public GameObject CreateIdol(int color, int shape, EventBind onPickupAction) { Material mat = idolMaterials[color]; GameObject originalItem = idolPrefabs[shape]; GameObject go = Instantiate(originalItem); Idol idol = go.GetComponent <Idol>(); idol.intMetaData = new int[] { color, shape }; idol.color = mat.name; go.name = mat.name; Renderer r = go.GetComponent <Renderer>(); r.material = mat; InventoryItem ii = go.GetComponent <InventoryItem>(); string[] floatyTextOptions = null; if (resourceNames == null || (resourceNames.TryGetValue(mat.name, out floatyTextOptions) && floatyTextOptions != null)) { string floatyTextString = floatyTextOptions[shape]; idol.kind = floatyTextString; ii.itemName = floatyTextString; } if (onPickupAction != null && !onPickupAction.IsAlreadyBound(ii.addToInventoryEvent)) { //Show.Log("bound "+onPickupAction.methodName); onPickupAction.Bind(ii.addToInventoryEvent); } return(go); }
public void AddPress(EventBind a) { if (onPress == null) { onPress = new UnityEvent(); } a.Bind(onPress); }
public void AddRelease(EventBind a) { if (onRelease == null) { onRelease = new UnityEvent(); } a.Bind(onRelease); }
public void AddHold(EventBind a) { if (onHold == null) { onHold = new UnityEvent(); } a.Bind(onHold); }