Exemplo n.º 1
0
    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);
    }
Exemplo n.º 2
0
 public void AddPress(EventBind a)
 {
     if (onPress == null)
     {
         onPress = new UnityEvent();
     }
     a.Bind(onPress);
 }
Exemplo n.º 3
0
 public void AddRelease(EventBind a)
 {
     if (onRelease == null)
     {
         onRelease = new UnityEvent();
     }
     a.Bind(onRelease);
 }
Exemplo n.º 4
0
 public void AddHold(EventBind a)
 {
     if (onHold == null)
     {
         onHold = new UnityEvent();
     }
     a.Bind(onHold);
 }