Esempio n. 1
0
        /// <summary>
        /// Takes a deserialized destination and sets up an answer button for it
        /// </summary>
        /// <param name="d">Deserialized destnation to setup</param>
        /// <param name="t">The transform to build the answer into</param>
        /// <returns></returns>
        public AnswerBehaviour BuildAnswer(Destination d, RectTransform t)
        {
            GameObject      ansObj   = Instantiate(answerPrefab, t);
            AnswerBehaviour toReturn = ansObj.GetComponent <AnswerBehaviour>();

            toReturn.Setup(d, this);

            return(toReturn);
        }
Esempio n. 2
0
        /// <summary>
        /// Build out each destination object.
        /// </summary>
        private void SetupNode()
        {
            int   numAns    = node.answers.Length;
            float offset    = destinationPanel.sizeDelta.y / numAns;
            float curOffset = 0;

            foreach (Destination d in node.answers)
            {
                AnswerBehaviour ans    = instance.BuildAnswer(d, destinationPanel);
                RectTransform   curAns = (RectTransform)ans.transform;
                curAns.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, curOffset, curAns.sizeDelta.y);
                curOffset += offset;
            }
        }