// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks
    //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    //
    //}
    // OnStateExit is called when a transition ends and the state machine finishes evaluating this state
    public override void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
        if(charController == null)
            charController = animator.GetComponent<RomanCharController>();

        //charController.RunStateLogic(AnimState.Enter);
    }
 // Use this for initialization
 void Start()
 {
     charState      = GetComponent <RomanCharState> ();
     charController = GetComponent <RomanCharController> ();
     animator       = GetComponent <Animator> ();
     rb             = GetComponent <Rigidbody> ();
 }
	// Use this for initialization
	void Start () 
	{
		charState = GetComponent<RomanCharState> ();
		charController = GetComponent<RomanCharController> ();
		animator = GetComponent <Animator> ();
		rb = GetComponent <Rigidbody> ();
	}
	private void Start ()
	{
		
		if (Instance == null)
			Instance = this;
		else
			Destroy(this);

//		if (cam == null)
//			cam = Camera.main.GetComponent<TestCam>();
		simpleRpgCam = Camera.main.GetComponent<PhatRobit.SimpleRpgCamera>();

		charState = GameObject.FindObjectOfType<RomanCharState> ();
		//camScript = GameObject.FindObjectOfType<RomanCameraController> ();
		climbDetector = GameObject.FindObjectOfType<ClimbDetector> ();
		follow = GameObject.FindObjectOfType<FollowPlayer>();
		vineClimbCollider = GameObject.FindObjectOfType<VineClimbController2>();
		charController = GameObject.FindObjectOfType<RomanCharController>();
		tunnelObserver = GameObject.FindObjectOfType<TunnelObserver>();
		antiWallSlideController = GameObject.FindObjectOfType<SloapDetector>();

		//cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<TestCam>();

		// Get the character that is selected
		if (charController != null)
			currentChar = charController.transform;
	}
    private static float lastJumpTime;                                                                  //Time stamp of the last time the char jumped
    // Use this for initialization

    //private Vector3 bounceDirection;

    void Start()
    {
        animator       = GetComponent <Animator>();
        rb             = GetComponent <Rigidbody>();
        charController = GetComponent <RomanCharController>();
        charState      = GetComponent <RomanCharState>();
        cCollider      = GetComponent <CapsuleCollider>();

        if (cColliderFrontTransf == null)
        {
            Debug.Log("collider front point not defined");
        }

//		ComponentActivator.Instance.Register(this, new Dictionary<GameEvent, bool> {
//			{ GameEvent.StartWallClimbing, false }
//
//		});
    }
    private void Awake()
    {
        EventManager.onCharEvent = null;
        EventManager.onInputEvent = null;
        EventManager.onDetectEvent = null;

        if (Instance == null)
            Instance = this;
        else
            Destroy(this);

        charState = GameObject.FindObjectOfType<RomanCharState> ();
        //camScript = GameObject.FindObjectOfType<RomanCameraController> ();
        climbDetector = GameObject.FindObjectOfType<ClimbDetector> ();
        follow = GameObject.FindObjectOfType<FollowPlayer>();
        vineClimbCollider = GameObject.FindObjectOfType<VineClimbController2>();
        charController = GameObject.FindObjectOfType<RomanCharController>();
    }
	private static float lastJumpTime;								//Time stamp of the last time the char jumped
	// Use this for initialization

	//private Vector3 bounceDirection;

	void Start () 
	{
		animator = GetComponent<Animator>();
		rb = GetComponent<Rigidbody>();
		charController = GetComponent<RomanCharController>();
		charState = GetComponent<RomanCharState>();
		cCollider = GetComponent<CapsuleCollider>();

		if (cColliderFrontTransf == null)
			Debug.Log("collider front point not defined");

//		ComponentActivator.Instance.Register(this, new Dictionary<GameEvent, bool> {
//			{ GameEvent.StartWallClimbing, false }
//
//		});
	}
    // OnStateEnter is called before OnStateEnter is called on any state inside this state machine
	override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
		if(charController == null)
			charController = animator.GetComponent<RomanCharController>();
			
		charController.ApplyRootMotion(apply);	
	}