rewrite character controller in C#