void Update() { switch (state) { case State.Free: { var ddp = new Vector3(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"), 0); if (ddp.magnitude > 1) { ddp.Normalize(); } transform.position = transform.position + (ddp * MoveSpeed * Time.deltaTime); if (possibleInteraction != null && Input.GetKeyDown(KeyCode.E)) { var interactionController = InteractionController.GetInstance(); interactionController.BeginInteraction(possibleInteraction); state = State.Interacting; } break; } case State.Interacting: { if (Input.GetKeyDown(KeyCode.Escape)) { var interactionController = InteractionController.GetInstance(); interactionController.EndInteraction(); state = State.Free; } break; } } }