public RocketRunner(IDeactivateableTargetKnower knower, IPilot engineControl, IDetonator detonator, FuelTank tank) { _pilot = engineControl; _detonator = detonator; _targetKnower = knower; _tank = tank; }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilot = pilots.FirstOrDefault(p => p.Name == selectedPilotName); if (pilot is null) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } IMachine machine = machines.FirstOrDefault(m => m.Name == selectedMachineName); if (machine is null) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } if (machine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } machine.Pilot = pilot; return(string.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilot = this.pilots .FirstOrDefault(x => x.Name == selectedPilotName); if (pilot == null) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } IMachine machine = this.machines .FirstOrDefault(x => x.Name == selectedMachineName); if (machine == null) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } if (machine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } pilot.AddMachine(machine); machine.Pilot = pilot; return(string.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IMachine machine = machines.FirstOrDefault(m => m.Name == selectedMachineName); IPilot pilot = pilots.FirstOrDefault(p => p.Name == selectedPilotName); if (!pilots.Any(p => p.Name == selectedPilotName)) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } else if (!machines.Any(m => m.Name == selectedMachineName)) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } else if (machines.First(m => m.Name == selectedMachineName).Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } else if (machines.First(m => m.Name == selectedMachineName).Pilot is null) { machine.Pilot = pilot; pilot.AddMachine(machine); return(string.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); } return(null); }
public void RemovePilot(IPilot pilot) { if (pilots.Contains(pilot)) { pilots.Remove(pilot); } }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { if (this.pilots.FirstOrDefault(p => p.Name == selectedPilotName) == null) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } if (this.machines.FirstOrDefault(m => m.Name == selectedMachineName) == null) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } IPilot pilot = this.pilots.FirstOrDefault(p => p.Name == selectedPilotName); IMachine machine = this.machines.FirstOrDefault(m => m.Name == selectedMachineName); if (machine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, machine.Name)); } machine.Pilot = pilot; pilot.AddMachine(machine); return(string.Format(OutputMessages.MachineEngaged, pilot.Name, machine.Name)); }
async Task IServer.Access(int accessCount, IPilot pilot, Game game) { reshuffledDuringAccess = false; var accessDepth = 0; for (var accessesLeft = accessCount; accessesLeft > 0; accessesLeft--) { if (accessDepth > Zone.Cards.Count) { break; } var nextCard = Zone.Cards[accessDepth]; // TODO show top of R&D and cards in root // TODO2: should draw facedown // TODO3: nice if we could display the pile, not just the top+root var cardToAccess = await pilot.ChooseACard().Declare("Which card to access now?", new List <Card> { nextCard }, game); accessDepth++; await new AccessCard(cardToAccess, game).AwaitEnd(); // TODO show the already seen on the side, maintaining proper order CR: 7.2.1.b if (reshuffledDuringAccess) // CR: 7.2.1.c { accessDepth = 0; reshuffledDuringAccess = false; } } }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilot = this.pilots .FirstOrDefault(p => p.Name == selectedPilotName); if (pilot == null) { return($"Pilot {selectedPilotName} could not be found"); } IMachine machine = this.machines .FirstOrDefault(m => m.Name == selectedMachineName); if (machine == null) { return($"Machine {selectedMachineName} could not be found"); } if (machine.Pilot != null) { return($"Machine {selectedMachineName} is already occupied"); } pilot.AddMachine(machine); machine.Pilot = pilot; return($"Pilot {selectedPilotName} engaged machine {selectedMachineName}"); }
// Use this for initialization void Start() { _rigidbody = GetComponent <Rigidbody>(); var initialAngularDrag = _rigidbody.angularDrag; var torqueApplier = new MultiTorquerTorqueAplier(_rigidbody, TorqueMultiplier, initialAngularDrag); _pilot = new RocketPilot(torqueApplier, _rigidbody, Engines, StartDelay) { LocationAimWeighting = LocationAimWeighting, TurningStartDelay = TurningStartDelay, VectorArrow = VectorArrow, TimeThresholdForMaximumEvasion = TimeThresholdForMaximumEvasion, TimeThresholdForMediumEvasion = TimeThresholdForMediumEvasion, TimeThresholdForMinimalEvasion = TimeThresholdForMinimalEvasion, EvasionModeTime = EvasionModeTime, MinimumFriendlyDetectionDistance = MinimumFriendlyDetectionDistance }; var exploder = new ShrapnelExploder(_rigidbody, Shrapnel, ExplosionEffect, ShrapnelCount) { EnemyTags = TargetChoosingMechanism.EnemyTagKnower.KnownEnemyTags, TagShrapnel = TagShrapnel, SetEnemyTagOnShrapnel = SetEnemyTagOnShrapnel, ShrapnelSpeed = ShrapnelSpeed }; _detonator = new ProximityApproachDetonator(exploder, _rigidbody, TimeToTargetForDetonation, ShrapnelSpeed); _runner = new RocketRunner(TargetChoosingMechanism, _pilot, _detonator, Tank) { name = transform.name }; }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilot = (Pilot)this.pilots .FirstOrDefault(p => p.Name == selectedPilotName && p.GetType().Name == "Pilot"); IMachine machine = (BaseMachine)this.machines.FirstOrDefault(m => m.Name == selectedMachineName); if (pilot == null) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } else if (machine == null) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } else if (machine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } else { machine.Pilot = pilot; pilot.AddMachine(machine); return(string.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); } }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilotToFind = this.pilots.FirstOrDefault(p => p.Name == selectedPilotName); bool isPilotExists = pilotToFind != null; IMachine machineToFind = this.machines.FirstOrDefault(m => m.Name == selectedMachineName); bool isMachineExists = machineToFind != null; bool isMachineFree = machineToFind?.Pilot == null; if (!isPilotExists) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } if (!isMachineExists) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } if (!isMachineFree) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } machineToFind.Pilot = pilotToFind; return(string.Format(OutputMessages.MachineEngaged, pilotToFind.Name, machineToFind.Name)); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { StringBuilder sb = new StringBuilder(); IPilot pilot = pilots.FirstOrDefault(p => p.Name == selectedPilotName); IMachine machine = machines.FirstOrDefault(m => m.Name == selectedMachineName); if (pilot == null) { sb.AppendLine($"{string.Format(OutputMessages.PilotNotFound, selectedPilotName) }"); } else if (machine == null) { sb.AppendLine($"{string.Format(OutputMessages.MachineNotFound, selectedMachineName) }"); } else if (machine != null) { //IPilot machinePilot = machine.Pilot; if (machine.Pilot != null) { sb.AppendLine($"{string.Format(OutputMessages.MachineHasPilotAlready, machine.Name)}"); } else if (machine.Pilot == null) { pilot.AddMachine(machine); machine.Pilot = pilot; sb.AppendLine($"{string.Format(OutputMessages.MachineEngaged, pilot.Name, machine.Name)}"); } } return(sb.ToString().TrimEnd()); }
public UpgradeSelector(IPilot pilot, IUpgradeSlot slot, IEnumerable <IUpgrade> uniquesTaken) { Pilot = pilot; Slot = slot; UniquesTaken = uniquesTaken; SlotsAvaiable = pilot.Upgrades.Where(x => x.Upgrade.Name == "" && x.UpgradeType.Equals(slot.UpgradeType)).Count(); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IMachine machine = this.machines.FirstOrDefault(x => x.Name == selectedMachineName && x.Pilot == null); string result = string.Empty; IPilot pilot = this.pilots.FirstOrDefault(x => x.Name == selectedPilotName); if (pilot == null) { result = $"Pilot {selectedPilotName} could not be found"; } else if (machine == null) { result = $"Machine {selectedMachineName} could not be found"; } else if (machine.Pilot != null) { result = $"Machine {selectedMachineName} is already occupied"; } else { machine.Pilot = pilot; pilot.AddMachine(machine); result = $"Pilot {selectedPilotName} engaged machine {selectedMachineName}"; } return(result); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot pilot = null; IMachine machine = null; if (!pilots.ContainsKey(selectedPilotName)) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } pilot = pilots[selectedPilotName]; if (!machines.ContainsKey(selectedMachineName)) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } machine = machines[selectedMachineName]; if (machine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, selectedMachineName)); } pilot.AddMachine(machine); machine.Pilot = pilot; return(string.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { IPilot foundPilot = this.pilots .FirstOrDefault(p => p.Name == selectedPilotName); IMachine foundMachine = this.machines .FirstOrDefault(p => p.Name == selectedMachineName); if (foundPilot == null) { return(string.Format(OutputMessages.PilotNotFound, selectedPilotName)); } if (foundMachine == null) { return(string.Format(OutputMessages.MachineNotFound, selectedMachineName)); } if (foundMachine.Pilot != null) { return(string.Format(OutputMessages.MachineHasPilotAlready, foundMachine.Name)); } else { foundPilot.AddMachine(foundMachine); foundMachine.Pilot = foundPilot; return(string.Format(OutputMessages.MachineEngaged, foundPilot.Name, foundMachine.Name)); } }
public string PilotReport(string pilotReporting) { IPilot pilot = this.pilots .FirstOrDefault(p => p.Name == pilotReporting); return(pilot.Report()); }
public SpaceshipRunner(ITargetDetector detector, ITargetPicker picker, IPilot pilot, IKnowsCurrentTarget knower) { _detector = detector; _picker = picker; _pilot = pilot; _knower = knower; }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { if (!IsThatPilotExist(selectedPilotName)) { return(String.Format( OutputMessages.PilotNotFound, selectedPilotName)); } if (!IsThatMachineExist(selectedMachineName)) { return(String.Format( OutputMessages.MachineNotFound, selectedPilotName)); } IPilot pilot = this.pilots[selectedPilotName]; IMachine machine = this.machines[selectedMachineName]; if (machine.Pilot != null) { return(String.Format( OutputMessages.MachineHasPilotAlready, selectedMachineName)); } pilot.AddMachine(machine); machine.Pilot = pilot; return(String.Format(OutputMessages.MachineEngaged, selectedPilotName, selectedMachineName)); }
public string EngageMachine(string selectedPilotName, string selectedMachineName) { if (this.pilots.ContainsKey(selectedPilotName) == false) { return($"Pilot {selectedPilotName} could not be found"); } if (this.machines.ContainsKey(selectedMachineName) == false) { return($"Machine {selectedMachineName} could not be found"); } //dont know what machine not occupied means //one more if statement IPilot pilot = this.pilots[selectedPilotName]; IMachine machine = this.machines[selectedMachineName]; if (machine.Pilot != null) { return($"Machine {selectedMachineName} is already occupied"); } pilot.AddMachine(machine); machine.Pilot = pilot; return($"Pilot {selectedPilotName} engaged machine {selectedMachineName}"); }
public PilotViewModel(IPilot pilot) { Pilot = pilot; Pilot.PropertyChanged += (sender, e) => { RaisePropertyChanged(nameof(Upgrades)); }; }
public string PilotReport(string pilotReporting) { IPilot pilot = this.pilots .Where(x => x.Name == pilotReporting) .FirstOrDefault(); return(pilot.Report()); }
public RocketRunner(ITargetDetector targetDetector, ITargetPicker targetPicker, IPilot engineControl, IDetonator detonator, IKnowsCurrentTarget knower) { _targetDetector = targetDetector; _targetPicker = targetPicker; _pilot = engineControl; _detonator = detonator; _knower = knower; }
protected Machine(string name, double attackPoints, double defensePoints) { this.Name = name; this.pilot = null; this.AttackPoints = attackPoints; this.DefensePoints = defensePoints; this.targets = new List<string>(); }
public Machine(string name, double healthpoints, double attackPoints, double defencePoints, IPilot pilot = null) { this.Name = name; this.HealthPoints = healthpoints; this.attackPoints = attackPoints; this.defencePoints = defencePoints; this.targets = new List<string>(); }
public Tank(string name, IPilot pilot, double attackPoints, double defencePoints) : base(name, pilot, attackPoints, defencePoints) { this.AttackPoints -= 40; this.DefensePoints += 30; this.DefenseMode = true; this.HealthPoints = 100; }
public Machine(string name, IPilot pilot, double attackPoints, double defencePoints) { this.Name = name; this.Pilot = pilot; this.targets = new List <string>(); this.AttackPoints = attackPoints; this.DefensePoints = defencePoints; }
public bool Equals(IPilot other) { return(Name == other.Name && ShipName == other.ShipName && other.Upgrades.All(Upgrades.Contains) && other.Upgrades.Count == Upgrades.Count && other.UpgradesCost == UpgradesCost); }
protected Machine(string name, double attackPoints, double defensePoints) { this.Name = name; this.pilot = null; this.AttackPoints = attackPoints; this.DefensePoints = defensePoints; this.targets = new List <string>(); }
public Machine(string name, IPilot pilot, double healthPoints, double attackPoints, double defensePoints) { this.Name = name; this.pilot = pilot; this.HealthPoints = healthPoints; this.attackPoints = attackPoints; this.defensePoints = defensePoints; }
//private List<string> targets; public BaseMachine(string name, double attackPoints, double defensePoints, double healthPoints) { this.Name = name; this.AttackPoints = attackPoints; this.DefensePoints = defensePoints; this.HealthPoints = healthPoints; this.pilot = null; this.Targets = new List <string>(); }
//Constructor with all fields public Machine(string machineName, IPilot pilot, double healthPoints, double attackPoints, double defensePoints, IList <string> targets) { this.Name = machineName; this.Pilot = pilot; this.HealthPoints = healthPoints; this.attackPoints = attackPoints; this.defensePoints = defensePoints; this.targets = targets; }
public async Task NavigateToPilotDetailsAsync(IPilot pilot) { if (!SquadronViewModel.Squadron.AddPilot(pilot)) { return; } await NavigationService.NavigateAsync(typeof(SquadronBuilder)); }
public Mashine(string name, IPilot pilot, double healthPoint, double attckPoints, double defensePoints,IList<string>targets) { this.Name = name; this.Pilot = pilot; this.HealthPoints = healthPoint; this.AttackPoints = attckPoints; this.DefensePoints = defensePoints; this.Targets = targets; }
public void JoinRace(IPilot pilot) { if (!_pilots.Contains(pilot)) _pilots.Add(pilot); }
public Fighter(string name, double attackPoints, double defensePoints, bool stealthMode, IPilot pilot = null) : base(name, 200, attackPoints, defensePoints, pilot) { this.stealthMode = stealthMode; }
public Tank(string name, IPilot pilot, double healthPoints, double attackPoints, double defensePoints) : base(name, pilot, 100, attackPoints - DefModeAttPoints, defensePoints + DefModeDefPoints) { }
public Fighter(string name, IPilot pilot, double healthPoints, double attackPoints, double defensePoints, bool stealthMode) : base(name, null, 200, attackPoints, defensePoints) { this.stealthMode = stealthMode; }
public Tank(string name, double attackPoints, double defencePoints, IPilot pilot = null) : base(name, 100, attackPoints, defencePoints, pilot = null) { ToggleDefenseMode(); }
public Fighter(string name, IPilot pilot, double healthPoint, double attckPoints, double defensePoints, IList<string> targets) { }
public void LeaveRace(IPilot pilot) { if (_pilots.Contains(pilot)) _pilots.Remove(pilot); }