Exemple #1
0
    // Use this for initialization
    void Start()
    {
        if (descriptor)
        {
            if (descriptor.noObject)
            {
                var obj = Instantiate(descriptor.noObject);
                obj.transform.position = noBoxes[0].transform.position;
                obj.transform.parent   = this.transform;

                foreach (DecisionBox db in noBoxes)
                {
                    Destroy(db.gameObject);
                }

                var comp = obj.AddComponent <DecisionBox>();
                comp.decisionType = DecisionBox.DecisionType.NO;

                noBoxes[0] = comp;
            }

            if (descriptor.yesObject)
            {
                var obj = Instantiate(descriptor.yesObject);
                obj.transform.position = yesBoxes[0].transform.position;
                obj.transform.parent   = this.transform;

                foreach (DecisionBox db in yesBoxes)
                {
                    Destroy(db.gameObject);
                }

                var comp = obj.AddComponent <DecisionBox>();
                comp.decisionType = DecisionBox.DecisionType.YES;

                yesBoxes[0] = comp;
            }

            if (descriptor.Title != "")
            {
                display.gameObject.SetActive(true);
                display.DisplayTitle(descriptor.Title, descriptor.textNO, descriptor.textYES);

                display.transform.parent = null;
                Destroy(display.gameObject, 3f);
            }
        }
    }