- Home /
Question by
Hazz · Jan 28, 2015 at 09:02 PM ·
stringmethodparameterscalling
Call a method by string with parameters
I have a class Mover
public class Mover : MonoBehaviour {
public void Action (string move_type, float dist) {
if (...) {
moveType += "Aggressive"
}
// How do i call moveType(dist) ??
}
private void Move(float dist) { ... }
private void MoveAggressive(float dist) { ... }
private void Jump(float dist) { ... }
private void JumpAggressive(float dist) { ... }
public
and a some class which do
Mover.Action("move", 10.0f);
Mover.Action("jump", 3.3f);
How do i call move_type or aggressive move_type depending on condition?
Comment