Esempio n. 1
0
        public void SetInteractionPanel(Responsible responsible, Interactable.Base.Interactable target, object[] parameters, Vector3 panelPosition)
        {
            CreateInteractionPanel(panelPosition);

            HashSet <MethodInfo> methods = target.GetComponent <Interactable.Base.Interactable>().Methods;

            Debug.Log(methods.Count);

            foreach (var method in methods)
            {
                InteractableAttribute [] interactableAttributes =
                    System.Attribute.GetCustomAttributes(method, typeof(InteractableAttribute)) as InteractableAttribute[];



                if (interactableAttributes == null)
                {
                    Debug.Log("Method's interactable type is missing!");
                    return;
                }

                foreach (var interactableAttribute in interactableAttributes)
                {
                    if (interactableAttribute.InteractableType == responsible.GetType() || interactableAttribute.InteractableType == responsible.GetType().BaseType)
                    {
                        JobInfo jobInfo = new JobInfo(responsible, target, method, parameters);
                        AddInteractionButton(jobInfo);
                    }
                }
            }
        }