private void switchState()
 {
     if ( transition == Transitions.M1 ) {
         Ray ray = mainCamera.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if ( Physics.Raycast(ray, out hit, Mathf.Infinity, LayerMask.GetMask("Clickable")) &&
             hit.collider.tag == "Enemy") {
             GameObject tempEnemy = hit.collider.gameObject;
             tempEnemy.GetComponent<MonsterScript>().rightClicked();
             currentState.chase(this, tempEnemy);
         } else {
             currentState.doMove(this);
         }
     } else if ( transition == Transitions.AM0 ) {
         currentState.attackMove(this);
     } else if ( attackComponent.AttackRange ) {
         if ( !attackComponent.Attacking ) {
             currentState.attack(this, enemy);
         }
     } else if ( inRange(FindClosestEnemy(), navComponent.SeeRange) ) {
         currentState.chase(this, null);
     } else if ( checkType(typeof(ATTACKING)) ) {
         if ( enemy == null || enemy.GetComponent<MonsterScript>().Health.Health <= 0 ) {
             currentState = new IDLE();
         }
     }
     if ( checkType(typeof(CHASING)) ) {
         navComponent.MoveTo(enemy.transform.position);
     }
     if ( checkType(typeof(ATTACKMOVE)) || checkType(typeof(MOVE)) ) {
         if ( navComponent.ReachedDestination() ) {
             navComponent.Stop();
             currentState = new IDLE();
         }
     }
 }
 public void setCurrentState(State state)
 {
     this.currentState = state;
 }