//////////////// public static void SendToServer(int beg_tile_x, int beg_tile_y, int end_tile_x, int end_tile_y) { var factory = new MyFactory(beg_tile_x, beg_tile_y, end_tile_x, end_tile_y); TunnelEntitySpawnProtocol protocol = factory.Create(); protocol.SendToServer(false); }
// this is the single method defined by the LoadEventListener interface public override void OnLoad(LoadEvent theEvent, LoadType loadType) { if(null == theEvent.InstanceToLoad) // Not null if user supplied object { theEvent.InstanceToLoad = MyFactory.Create(loadType); // Or whatever. } }
internal static void Main(string[] args) { var objectWithoutParameter = MyObject.GetFactory().Create(); var objectWithParameter = MyObject.GetFactory().Create("a simple parameter"); var factory = new MyFactory("default parameter"); var objectWithoutDefaultParameter = factory.Create(); Console.WriteLine(objectWithoutParameter.ToString()); Console.WriteLine(objectWithParameter.ToString()); Console.WriteLine(objectWithoutDefaultParameter.ToString()); Console.Read(); }
public void Test() { ChildClass bs = MyFactory.Create <ChildClass>(10); }