Esempio n. 1
0
    public virtual void Init()
    {
        if (_initialized)
        {
            return;
        }

        _animator = GetComponent <Animator>();
        _graph    = PlayableGraph.Create();
        _graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
        _graphConnected = false;

        AnimationPlayable template = new AnimationPlayable();
        var playable = ScriptPlayable <AnimationPlayable> .Create(_graph, template, 1);

        _playable = playable.GetBehaviour();

        _initialized = true;
    }
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        var playable = ScriptPlayable <AnimationPlayable> .Create(graph);

        AnimationPlayable animationPlayable = playable.GetBehaviour();

        if (animationPlayable == null)
        {
            return(playable);
        }
        animationPlayable.AnimationName = AnimationName;
        animationPlayable.Role          = Role;
        animationPlayable.executer      = BehaviourExecuterFactory.GetAnimationExecuter(animationPlayable);
        if (animationPlayable.executer == null)
        {
            return(playable);
        }
        animationPlayable.executer.OnPlayableCreate(playable);
        return(playable);
    }
 public override void OnPlayableCreate(Playable playable)
 {
     base.OnPlayableCreate(playable);
     animationPlayable = behaviour as AnimationPlayable;
 }