Esempio n. 1
0
    internal void AddReference(ISceneUpdatable mb)
    {
        if (updatables == null)
        {
            updatables = new List <ISceneUpdatable>();
        }

        updatables.Add(mb);
    }
Esempio n. 2
0
    public void ProcessSceneUpdatable(MonoBehaviour mb)
    {
        ISceneUpdatable sceneUpdatable = (ISceneUpdatable)mb;

        foreach (string stateName in sceneUpdatable.targetStateNames)
        {
            int fullPathHash = Animator.StringToHash("Base Layer." + stateName);
            int stateHash    = Animator.StringToHash(stateName);

            if (animator.HasState(0, stateHash))
            {
                foreach (StateMachineBehaviour stateMachineBehaviour in animator.GetBehaviours(fullPathHash, 0))
                {
                    if (!(stateMachineBehaviour is SceneManagerUpdater))
                    {
                        continue;
                    }

                    ((SceneManagerUpdater)stateMachineBehaviour).AddReference(sceneUpdatable);
                    sceneUpdatable.OnInit(stateName);
                }
            }
        }
    }