public class Tile
{
   State state ;
   public void OnStep()
   {
       if(state == State.normal) { // Do something; }
       else if(state == State.empty) { // Do something; }
       else if(state == State.hazard) { // Do something; }
   }
}
Basically, OnStep will do different behaviours according to the 'state' variable.
I really want to remove those 'if statements' yet I do not want to change Tile class into an abstract class. It works now but I want to know if there is a better technique to manage this. Currently 'State' is enum. ( I am wondering if there is anything that can bind both state and action at the same time ).
 
     
     
    