Ejemplo n.º 1
0
        private void Init()
        {
            RatAnimator = GetComponent <RatAnimator>();

            ratStateMachine.Init(this);

            idling     = new Idle();
            walking    = new Walk();
            jumping    = new Jump();
            climbing   = new Climb();
            jumpingOff = new JumpOff();

            idling.Init(this, ratStateMachine);
            walking.Init(this, ratStateMachine);
            jumping.Init(this, ratStateMachine);
            climbing.Init(this, ratStateMachine);
            jumpingOff.Init(this, ratStateMachine);

            ratStateMachine.AddState(idle, idling);
            ratStateMachine.AddState(walk, walking);
            ratStateMachine.AddState(jump, jumping);
            ratStateMachine.AddState(climb, climbing);
            ratStateMachine.AddState(jumpOff, jumpingOff);
            ratStateMachine.ChangeState(idle);

            //update helpers
            rotationUpdater.Add(UpdateRotation);
        }
Ejemplo n.º 2
0
    // Use this for initialization
    void Start()
    {
        _animator = gameObject.GetComponentInChildren<Animator> ();
        w = _animator.GetBehaviour<Walk> ();

        w.Init (velocity, transform);
    }