Ejemplo n.º 1
0
    public override void ReInit(Patient patient)
    {
        base.ReInit(patient);

        Transform[] childs = rengenParent.transform.GetComponentsInChildren <Transform>();
        for (byte i = 1; i < childs.Length; ++i)
        {
            Destroy(childs[i].gameObject);
        }

        organPosHolder = Instantiate(patient.ui.rengenPrefab, rengenParent.transform).GetComponent <OrganPosHolder>();

        organs = new Organ[organPosHolder.organPos.Length];
        for (byte i = 0; i < patient.organs.Length; ++i)
        {
            if (patient.organs[i] != null)
            {
                Organ organ = Instantiate(patient.organs[i], organPosHolder.organPos[i]);
                organ.name = patient.organs[i].name;
                organ.SetRaycastTarget(false);
                organPosHolder.onClickAction[i] += ProcessClickOnRengen;

                organs[i] = organ;
            }
            else
            {
                organPosHolder.onClickAction[i] += ProcessClickOnRengen;
                organs[i] = null;
            }
        }
    }
Ejemplo n.º 2
0
 public void TryCraft()
 {
     for (byte i = 0; i < organ.avaliableCrafts.Count; ++i)
     {
         if (organ.avaliableCrafts[i].tool == GameManager.Instance.selectedTool)
         {
             Organ newOrgan = Instantiate(organ.avaliableCrafts[i].result, organPos);
             newOrgan.name = organ.avaliableCrafts[i].result.name;
             newOrgan.SetRaycastTarget(false);
             Destroy(organ.gameObject);
             organ = newOrgan;
             return;
         }
     }
 }