protected IMove createMoveFromType(MoveType typeOfMove) { Type t = Type.GetType(string.Format("{0}.{1}", Assembly.GetExecutingAssembly().GetName().Name, typeOfMove.ToString())); IMove move = Activator.CreateInstance(t) as IMove; PlayedMoves.Add(move); Console.WriteLine("{0}{1}{2}", Name, Constants.COMPUTER_MOVE, move.TypeOfMove); return(move); }
public override IMove Move() { string input = string.Empty; while (!Enum.GetNames(typeof(MoveType)).Contains(input)) { Console.Write("{0}, {1}", Name, Constants.ENTER_YOUR_MOVE); input = Console.ReadLine(); } Type t = Type.GetType(string.Format("{0}.{1}", Assembly.GetExecutingAssembly().GetName().Name, input)); IMove move = Activator.CreateInstance(t) as IMove; PlayedMoves.Add(move); return(move); }