class GGameState {
string name;
GGameState() {
name = "";
}
GGameState(string nm) {
name = nm;
}
void update(float t) {
print("update in base class");
}
}
class GStateManager {
dictionary states;
string currentState;
void addState(object@ st, bool makeCurrent = true) {
states.set(st.name, st);
if (makeCurrent) {
currentState = st.name;
}
}
void update(float t) {
GGameState @state;
if (states.get(currentState, @state)) {
state.update(t);
} else {
print("notfound "+currentState);
}
}
}
Now if i execute the following code:
class MyState : GGameState
{
MyState(string nm) {
super(nm);
}
void update(float t) {
print("update in state");
}
}
GStateManager @man = GStateManager();
MyState @mainState = MyState("aggi");
man.addState(mainState);
man.update(0.1);
I get "update in base class", not as i would expect (and want) "update in state"
How can i achieve this in angelscript?
Thanx