コード例 #1
0
        private void Start()
        {
            InitializeUpdateFlags(true, false, false);

            model = GetComponent <PlayerModel>();
            NullOrEmptyExtension.AssertNotNull(model);

            rigidbody = GetComponent <Rigidbody2D>();
            NullOrEmptyExtension.AssertNotNull(rigidbody);

            characterController = GetComponent <CharacterController2D>();
            NullOrEmptyExtension.AssertNotNull(characterController);

            animator = GetComponent <Animator>();
            NullOrEmptyExtension.AssertNotNull(animator);

            monoBehaviourManager = dependencyLocator.monoBehaviourManager;
            NullOrEmptyExtension.AssertNotNull(monoBehaviourManager);

            input = dependencyLocator.inputManager;
            NullOrEmptyExtension.AssertNotNull(input);

            for (int i = 0; i < model.states.Count; i++)
            {
                typeToState.Add(model.states[i].GetType(), ScriptableObject.CreateInstance(model.states[i].GetType()) as IState);
                stateToType.Add(typeToState[model.states[i].GetType()], model.states[i].GetType());
            }

            stateMachine.ChangeState(typeToState[typeof(Falling)]);
        }
コード例 #2
0
 private void Awake()
 {
     player = DependencyLocator.instance.player;
     input  = DependencyLocator.instance.inputManager;
     monoBehaviourManager = DependencyLocator.instance.monoBehaviourManager;
 }
コード例 #3
0
 private void Awake()
 {
     dependencyLocator    = DependencyLocator.instance;
     monoBehaviourManager = dependencyLocator.monoBehaviourManager;
 }