Exemple #1
0
 public void Reset()
 {
     original.Assign(false);
     rt.SetParent(original.transform);
     rt.anchoredPosition = Vector2.zero;
     slot = null;
 }
Exemple #2
0
    public void CheckForSlot(PointerEventData p)
    {
        List <RaycastResult> results = new List <RaycastResult>();

        raycaster.Raycast(p, results);
        bool assignment = false;

        foreach (RaycastResult r in results)
        {
            TeamRosterSlot newSlot = r.gameObject.GetComponent <TeamRosterSlot>();
            if (newSlot != null)
            {
                if (slot != null)
                {
                    slot.AssignCharacter(null);
                }
                slot = newSlot;
                newSlot.AssignCharacter(this);
                transform.SetParent(newSlot.transform);
                assignment = true;
                original.Assign(true);
            }
        }
        if (!assignment)
        {
            if (slot != null)
            {
                slot.AssignCharacter(null);
            }
        }
        rt.anchoredPosition = Vector3.zero;
    }