Ejemplo n.º 1
0
    public static BranchNodeController AddController(GameObject gameObject)
    {
        BranchNodeController c = gameObject.GetComponent <BranchNodeController>();

        if (c != null)
        {
            return(c);
        }

        if (gameObject.GetComponent <SpriteRenderer>() != null)
        {
            return(gameObject.AddComponent <BranchSpriteController>());
        }
        if (gameObject.GetComponent <UnityEngine.UI.Text>() != null)
        {
            return(gameObject.AddComponent <BranchUITextController>());
        }
        if (gameObject.GetComponent <ParticleSystem>() != null)
        {
            return(gameObject.AddComponent <BranchParticlesController>());
        }

        if (gameObject.GetComponent <Renderer>() != null)
        {
            return(gameObject.AddComponent <BranchUndefinedRendererController>());
        }

        return(gameObject.AddComponent <BranchNodeController>());
    }
Ejemplo n.º 2
0
 public virtual void Initialize()
 {
     if (isInitialized)
     {
         return;
     }
     _rendererController = BranchNodeControllerBuilder.AddController(gameObject);
     _opacity            = _rendererController.ExtractOpacity();
     _color        = _rendererController.ExtractColor();
     _isVisible    = _rendererController.ExtractIsVisible();
     isInitialized = true;
 }