Exemplo n.º 1
0
    static List <GameObject> GetComponentTargets(GameObject gameObject, ComponentInjectionType Type)
    {
        List <GameObject> result = new List <GameObject>();

        if ((Type & ComponentInjectionType.Self) != ComponentInjectionType.Undefined)
        {
            result.Add(gameObject);
        }

        if ((Type & ComponentInjectionType.Parent) != ComponentInjectionType.Undefined)
        {
            result.Add(gameObject.transform.parent.gameObject);
        }

        if ((Type & ComponentInjectionType.Children) != ComponentInjectionType.Undefined)
        {
            result.AddRange(GetChildObjects(gameObject));
        }

        if ((Type & ComponentInjectionType.Siblings) != ComponentInjectionType.Undefined)
        {
            List <GameObject> siblings = GetChildObjects(gameObject.transform.parent.gameObject);
            for (int siblingIndex = 0; siblingIndex < siblings.Count; siblingIndex++)
            {
                GameObject sibling = siblings[siblingIndex];
                if (sibling != gameObject)
                {
                    result.Add(sibling);
                }
            }
        }

        if ((Type & ComponentInjectionType.Scene) != ComponentInjectionType.Undefined)
        {
            List <GameObject> allObjects = GetAllObjectsFromAllScenes();
            result.AddRange(allObjects);
        }

        return(result);
    }
Exemplo n.º 2
0
 public ComponentInjectionAttribute(ComponentInjectionType Type)
 {
     this.Type = Type;
 }
Exemplo n.º 3
0
 public ComponentInjectionAttribute()
 {
     Type = ComponentInjectionType.Self;
 }