/// <summary> /// Initializes a new instance of the <see cref="ShotViewData"/> class. /// </summary> internal ShotViewData(ShotUnit unit) { #region Argument Check if (unit == null) { throw new ArgumentNullException("unit"); } #endregion this.UniqueId = unit.UniqueId; this.Position = unit.Position; this.Angle = unit.Angle; this.OwnerUniqueId = unit.Owner.UniqueId; this.Team = unit.Owner.Team; }
private void ProcessNewShots(IEnumerable <KeyValuePair <ChickenUnit, MoveInfo> > shootingMoves) { if (SettingsCache.Instance.DebugModeDisableShooting) { DebugHelper.WriteLine( "[{0}] Skipping any new shots since {1} is on.", MethodBase.GetCurrentMethod().GetQualifiedName(), Factotum.For <SettingsCache> .GetPropertyName(obj => obj.DebugModeDisableShooting)); return; } _newShotUnits.Clear(); foreach (var shootingMovePair in shootingMoves) { var unit = shootingMovePair.Key; if (!unit.CanShoot()) { DebugHelper.WriteLine("New shot from {{{0}}} has been skipped - too fast.", unit); continue; } if (_finalizingStage) { var thisShotTeam = unit.Team; if (_shotUnitsDirect.All(su => su.Owner.Team == thisShotTeam)) { DebugHelper.WriteLine( "New shot from {{{0}}} has been skipped - finalizing stage and no enemy shots.", unit); continue; } } var shot = new ShotUnit(unit, GetShotUniqueId()); _newShotUnits.Add(shot); unit.ShotEngineStepIndex = _moveCount.Value; DebugHelper.WriteLine("New shot {{{0}}} has been made by {{{1}}}.", shot, unit); } _shotUnitsDirect.AddRange(_newShotUnits); }
/// <summary> /// Initializes a new instance of the <see cref="ShotPresentation"/> class. /// </summary> internal ShotPresentation(GamePresentation gamePresentation, ShotUnit shotUnit) { #region Argument Check if (gamePresentation == null) { throw new ArgumentNullException("gamePresentation"); } if (shotUnit == null) { throw new ArgumentNullException("shotUnit"); } #endregion this.GamePresentation = gamePresentation; this.UniqueId = shotUnit.UniqueId; this.OwnerTeam = shotUnit.Owner.Team; this.InitialPosition = shotUnit.Position; this.Movement = shotUnit.Movement; }