public void Spawn() { switch (tankType) { case TankType.HeavyTank: builder = new HeavyTankBuilder(); break; case TankType.LightTank: builder = new LightTankBuilder(); break; default: builder = new HeavyTankBuilder(); break; } TankDirector director = new TankDirector(builder); TransformBase tr = spawnPoint.transform; director.Construct(tr.position.X, tr.position.Y); controllable = builder.GetResult(); controllable.transform.rotation = spawnPoint.transform.rotation; }
/// <summary> /// 建筑模式指导者,返回的是一个ITank类,在坦克工厂里调用此方法 /// </summary> /// <param name="builder"></param> /// <returns></returns> public static Tank Construct(ITankBuilder builder) { builder.AddTankAttr(); builder.AddGameObject(); builder.AddTurret(); builder.AddMonoBehavour(); builder.AddFlag(); builder.AddInTankSystem(); return(builder.GetResult()); }