Beispiel #1
0
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            DialogOptions script = (DialogOptions)target;

            if (GUILayout.Button("Connections"))
            {
                DialogOptions[] obs = new DialogOptions[script.options.Length];

                for (int i = 0; i < script.options.Length; i++)
                {
                    obs[i] = script.options[i].destination;
                }
                Selection.objects = obs;
            }
        }
Beispiel #2
0
        public bool Create(DialogOptions dialogOptions, System.Action <int> onSelect)
        {
            if (dialogOptions.options.Length == 0)
            {
                return(false);
            }

            const float radStart = Mathf.PI / 2f;

            float radianIncr = Mathf.PI * 2 / dialogOptions.options.Length;

            if (createdItems.Count > 0)
            {
                Debug.Log("Items not cleared: " + createdItems.Count);

                ClearItems(false);
            }

            for (int i = 0; i < dialogOptions.options.Length; i++)
            {
                FanMenuItem fmi = GameObject.Instantiate <FanMenuItem>(fanMenuItemTemplate, transform);

                float   radians   = radianIncr * i;
                Vector3 circleVec = new Vector3(Mathf.Cos(radStart + radians), Mathf.Sin(radStart + radians), 0f);
                Vector3 spritePos = circleVec * radius;
                Vector3 textPos   = circleVec * radius * 1.1f;
                fmi.transform.localPosition         = spritePos;
                fmi.tmpText.transform.localPosition = textPos;
                fmi.Create(dialogOptions.options[i].text, i, onSelect);
                fmi.gameObject.SetActive(false);
                fmi.GetComponent <BoxCollider>().enabled = false;
                createdItems.Add(fmi);
            }

            Debug.Log("Created items, size: " + createdItems.Count);

            return(true);
        }