Beispiel #1
0
 public override void Click()
 {
     if (nextpos != null)
     {
         parent.audio.PlayOneShot((AudioClip)Resources.Load("Sound/Release"));
         hover.SetActive(false);
         hold.transform.SetParent(nextpos.transform);
         hold.transform.localPosition = new Vector2(0.5f, -0.5f);
         hold.GetComponent <Rigidbody2D>().isKinematic     = false;
         hold.GetComponent <SpriteRenderer>().sortingOrder = lastSorting;
         parent.state = new State(parent);
         hold.ActionRelease(parent);
         this.hold.GetComponent <Collider2D>().enabled = true;
         parent.detectItem.nearspecials.Remove(hold);
         if (hold.transform.childCount > 0)
         {
             hold.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
         }
     }
     else if (!hold.placable)
     {
         hover.SetActive(false);
         hold.ActionRelease(parent);
         Object.Destroy(hold.gameObject);
         parent.state = new State(parent);
         hold.GetComponent <SpriteRenderer>().sortingOrder = lastSorting;
         if (hold.transform.childCount > 0)
         {
             hold.transform.GetChild(0).gameObject.GetComponent <SpriteRenderer>().color = new Color(1, 1, 1, 1);
         }
     }
 }