public override void Apply(TowerProperties p, ShotProperties s) { PawnProperties props = p as PawnProperties; Debug.Log("Tower Properties: " + p.GetType() + " " + (props == null) + " " + this.name + " ShotProperties: " + s.GetType()); effect(p as PawnProperties, s); }
private static BaseShotter CreateShooter(ShotProperties properties) { BaseShotter shooter; switch (properties.Mode) { case ShotMode.Classic: { var classicShooter = new ClassicShooter(); classicShooter.SetRotate(properties.ClassicCameraDx, properties.ClassicCameraDy); classicShooter.SetDistance(properties.ClassicCameraDistance); shooter = classicShooter; break; } case ShotMode.ClassicManual: { var classicShooter = new ClassisManualShooter(); classicShooter.SetRotate(properties.ClassicCameraDx, properties.ClassicCameraDy); classicShooter.SetDistance(properties.ClassicCameraDistance); shooter = classicShooter; break; } case ShotMode.Fixed: { var kunosShooter = new KunosShotter(); kunosShooter.SetCamera(properties.FixedCameraPosition, properties.FixedCameraLookAt, properties.FixedCameraFov, properties.FixedCameraExposure); shooter = kunosShooter; break; } default: throw new ArgumentOutOfRangeException(); } shooter.AcRoot = properties.AcRoot; shooter.CarId = properties.CarId; shooter.SkinIds = properties.SkinIds; shooter.ShowroomId = properties.ShowroomId; shooter.DisableWatermark = properties.DisableWatermark; shooter.DisableSweetFx = properties.DisableSweetFx; shooter.Filter = properties.Filter; shooter.Fxaa = properties.Fxaa; shooter.SpecialResolution = properties.SpecialResolution; shooter.MaximizeVideoSettings = properties.MaximizeVideoSettings; shooter.TemporaryDirectory = properties.TemporaryDirectory; return(shooter); }
public static async Task <string> ShotAsync(ShotProperties properties, IProgress <ShootingProgress> progress, CancellationToken cancellation) { var shooter = CreateShooter(properties); var iterableShooter = shooter as BaseIterableShooter; if (iterableShooter == null) { return(await Task.Run(() => { try { shooter.ShotAll(); return shooter.OutputDirectory; } finally { shooter.Dispose(); } }, cancellation)); } try { var skins = iterableShooter.CarSkins.ToIReadOnlyListIfItIsNot(); var position = 0; foreach (var carSkin in skins) { if (cancellation.IsCancellationRequested) { return(null); } progress.Report(new ShootingProgress { SkinId = carSkin, SkinNumber = position++, TotalSkins = skins.Count }); await iterableShooter.ShotAsync(carSkin); } return(iterableShooter.OutputDirectory); } finally { iterableShooter.Dispose(); } }
public static string Shot(ShotProperties properties) { BaseShotter shooter = null; try { shooter = CreateShooter(properties); shooter.ShotAll(); var result = shooter.OutputDirectory; shooter.Dispose(); return(result); } catch (Exception) { try { shooter?.Dispose(); } catch (Exception) { // ignored } throw; } }
public static ShotProperties Duplicate(ShotProperties properties) { ShotProperties newProperties = new ShotProperties(); // Base newProperties.Speed = properties.Speed; newProperties.Damage = properties.Damage; newProperties.DamageInstances = properties.DamageInstances; newProperties.HomingShot = properties.HomingShot; // Upgrade newProperties.GainsDamageWithRange = properties.GainsDamageWithRange; newProperties.CritChance = properties.CritChance; newProperties.CritMultiplier = properties.CritMultiplier; newProperties.PiercePerfect = properties.PiercePerfect; newProperties.Precision = properties.Precision; return(newProperties); }
public virtual void setProperties(ShotProperties properties) { this.properties = ShotProperties.Duplicate(properties); }
public override void Apply(TowerProperties p, ShotProperties s) { effect(p as KnightProperties, s as SplitShotProperties); }
public abstract void Apply(TowerProperties p, ShotProperties s);
public override void Apply(TowerProperties p, ShotProperties s) { effect(p as CastleProperties, s); }
public override void Apply(TowerProperties p, ShotProperties s) { effect(p as BishopProperties, s); }
public override void Apply(TowerProperties p, ShotProperties s) { effect(p as QueenProperties, s as NanoBotProperties); }