Beispiel #1
0
    private void Workshop_OnStoreItemAction(StoreItem item, StoreItemEvents type)
    {
        if (item == this.item && type == StoreItemEvents.Slotted)
        {
            Image img = item.SlottingImage;
            if (img == null)
            {
                icon.enabled = false;
            }
            else
            {
                icon.enabled        = true;
                icon.sprite         = img.sprite;
                icon.color          = img.color;
                icon.fillMethod     = img.fillMethod;
                icon.preserveAspect = img.preserveAspect;
                icon.fillAmount     = icon.fillAmount;
            }
        }
        else if (type == StoreItemEvents.Drag)
        {
            dragItem = item;
        }

        if (type == StoreItemEvents.Slotted || type == StoreItemEvents.Return || type == StoreItemEvents.None)
        {
            dragItem = null;
        }
    }
Beispiel #2
0
 public void Emit(StoreItem item, StoreItemEvents type)
 {
     if (OnStoreItemAction != null)
     {
         OnStoreItemAction(item, type);
     }
 }
Beispiel #3
0
 private void Workshop_OnStoreItemAction(StoreItem item, StoreItemEvents type)
 {
     if (type == StoreItemEvents.Hover)
     {
         SetHover(item);
     }
     else if (type == StoreItemEvents.Slotted || type == StoreItemEvents.Return)
     {
         StartCoroutine(ShowHelpDelayed());
     }
 }
Beispiel #4
0
    public void OnBeginDrag()
    {
        //Debug.Log (string.Format("{0}: DragStart {1} & {2}", name, SlottingImage.enabled, state));

        if (SlottingImage.enabled && state == StoreItemEvents.None)
        {
            workshop.Emit(this, StoreItemEvents.Drag);
            state = StoreItemEvents.Drag;
            transform.SetParent(dragParent);
        }
    }
Beispiel #5
0
 IEnumerator <WaitForSeconds> AnimateTo(Vector3 from, Vector3 to, StoreItemEvents endEvent)
 {
     for (int i = 0; i < steps; i++)
     {
         transform.position = Vector3.LerpUnclamped(from, to, retraction.Evaluate(i / (float)steps));
         yield return(new WaitForSeconds(delta));
     }
     transform.position = to;
     workshop.Emit(this, endEvent);
     state = StoreItemEvents.None;
     transform.SetParent(restParent);
 }
Beispiel #6
0
 private void Workshop_OnStoreItemAction(StoreItem item, StoreItemEvents type)
 {
     if (item == this)
     {
         if (type == StoreItemEvents.Slotted)
         {
             SlottingImage.enabled = false;
             transform.position    = sourcePosition.position + Noise;
         }
         else if (type == StoreItemEvents.Return)
         {
             SlottingImage.enabled = true;
         }
     }
 }
Beispiel #7
0
    private void Workshop_OnStoreItemAction(StoreItem item, StoreItemEvents type)
    {
        if (type == StoreItemEvents.Drag || type == StoreItemEvents.Slotted)
        {
            if (typeof(Powder) == item.Blueprint.GetType())
            {
                AudioClip snd = (item.Blueprint as Powder).audio;

                if (snd != null)
                {
                    SingleCam.ButtonSpeaker.PlayOneShot(snd);
                }
                else if (defaultPowder != null)
                {
                    SingleCam.ButtonSpeaker.PlayOneShot(defaultPowder);
                }
            }
            else if (defaultCharge != null)
            {
                SingleCam.ButtonSpeaker.PlayOneShot(defaultCharge);
            }
        }
    }