本文整理汇总了C#中AttackResult类的典型用法代码示例。如果您正苦于以下问题:C# AttackResult类的具体用法?C# AttackResult怎么用?C# AttackResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AttackResult类属于命名空间,在下文中一共展示了AttackResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessShot
/// <summary>
/// Process shot will throw an exception in the case of AI error resulting in a square being hit twice
/// </summary>
/// <param name="result">The result of the shot</param>
/// <param name="row">the row shot</param>
/// <param name="col">the column shot</param>
protected override void ProcessShot(int row, int col, AttackResult result)
{
if (result.Value == ResultOfAttack.ShotAlready)
{
throw new ApplicationException("Error in AI");
}
}
示例2: ProcessShot
/// <summary>
/// ProcessShot will be called uppon when a ship is found.
/// It will create a stack with targets it will try to hit. These targets
/// will be around the tile that has been hit.
/// </summary>
/// <param name="row">the row it needs to process</param>
/// <param name="col">the column it needs to process</param>
/// <param name="result">the result og the last shot (should be hit)</param>
protected override void ProcessShot(int row, int col, AttackResult result)
{
if (result.Value == ResultOfAttack.Hit) {
_CurrentState = AIStates.Searching;
} else if (result.Value == ResultOfAttack.ShotAlready) {
throw new ApplicationException("Error in AI");
}
}
示例3: ProcessShot
/// <summary>
/// ProcessShot will be called uppon when a ship is found.
/// It will create a stack with targets it will try to hit. These targets
/// will be around the tile that has been hit.
/// </summary>
/// <param name="row">the row it needs to process</param>
/// <param name="col">the column it needs to process</param>
/// <param name="result">the result og the last shot (should be hit)</param>
protected override void ProcessShot(int row, int col, AttackResult result)
{
if (result.Value == ResultOfAttack.Hit) {
_CurrentState = AIStates.TargetingShip;
AddTarget(row - 1, col);
AddTarget(row, col - 1);
AddTarget(row + 1, col);
AddTarget(row, col + 1);
} else if (result.Value == ResultOfAttack.ShotAlready) {
throw new ApplicationException("Error in AI");
}
}
示例4: Show
public void Show(AttackResult result)
{
gameObject.SetActive(true);
labelNumber.color = result.IsCritical ? Color.red : Color.white;
transform.localScale = Vector3.one * 4;
tween.DORewind();
tween.DOPlayForward();
if (!result.IsDodge)
{
Show(result.Damage.ToString());
}
else
{
Show("Miss");
}
}
示例5: PlayerAttacked
public override void PlayerAttacked(BasePlayer player, Point from, Point to, GamePieceType piece, AttackResult result)
{
EstimatedState[from.x, from.y] = null;
if (result == AttackResult.Win)
{
if (player != this)
{
EstimatedState[to.x, to.y] = GamePieceFactory.Create(piece, !this.IsRed);
}
}
else if (result == AttackResult.Tie)
{
EstimatedState[to.x, to.y] = null;
}
else if (result == AttackResult.Lose)
{
if (player == this)
{
EstimatedState[to.x, to.y] = GamePieceFactory.Create(piece, !this.IsRed);
}
}
}
示例6: Attack
public Attack()
{
this.result = AttackResult.Unknown;
}
示例7: ProcessShot
/// <summary>
/// ProcessShot will be called uppon when a ship is found.
/// </summary>
/// <param name="row">the row it needs to process</param>
/// <param name="col">the column it needs to process</param>
/// <param name="result">the result og the last shot (should be hit)</param>
protected override void ProcessShot(int row, int col, AttackResult result)
{
//easyAI does nothing with a shot
}
示例8: UpdateAttackResults
public void UpdateAttackResults(Coordinate lastAttack, AttackResult result, bool sunkShip)
{
if (uiState == UIState.Attacking)
{
uiState = UIState.WaitingToAttack;
ShowNotification(string.Format("Waiting for {0} to attack...", opponent.PlayerName));
}
else { HandleBadUIState(); }
// update attacks and ui elements
Attacks[lastAttack.X, lastAttack.Y].Result = result;
}
示例9: GetImageForAttackResult
private Uri GetImageForAttackResult(AttackResult result)
{
switch (result)
{
default:
case AttackResult.Unknown:
return new Uri("resources/images/attacks/attackResult_Unknown.png", UriKind.Relative);
case AttackResult.Miss:
return new Uri("resources/images/attacks/attackResult_Miss.png", UriKind.Relative);
case AttackResult.Hit:
return new Uri("resources/images/attacks/attackResult_Hit.png", UriKind.Relative);
}
}
示例10: AttackCompleted
/// <summary>
/// Listens for attacks to be completed.
/// </summary>
/// <param name="sender">the game</param>
/// <param name="result">the result of the attack</param>
/// <remarks>
/// Displays a message, plays sound and redraws the screen
/// </remarks>
private static void AttackCompleted(object sender, AttackResult result)
{
bool isHuman = false;
isHuman = object.ReferenceEquals(_theGame.Player, HumanPlayer);
if (isHuman) {
Message = "You " + result.ToString();
} else {
Message = "The AI " + result.ToString();
}
switch (result.Value) {
case ResultOfAttack.Destroyed:
PlayHitSequence(result.Row, result.Column, isHuman);
Audio.PlaySoundEffect(GameSound("Sink"));
break;
case ResultOfAttack.GameOver:
PlayHitSequence(result.Row, result.Column, isHuman);
Audio.PlaySoundEffect(GameSound("Sink"));
while (Audio.SoundEffectPlaying(GameSound("Sink"))) {
SwinGame.Delay(10);
SwinGame.RefreshScreen();
}
if (HumanPlayer.IsDestroyed) {
Audio.PlaySoundEffect(GameSound("Lose"));
} else {
Audio.PlaySoundEffect(GameSound("Winner"));
}
break;
case ResultOfAttack.Hit:
PlayHitSequence(result.Row, result.Column, isHuman);
break;
case ResultOfAttack.Miss:
PlayMissSequence(result.Row, result.Column, isHuman);
break;
case ResultOfAttack.ShotAlready:
Audio.PlaySoundEffect(GameSound("Error"));
break;
}
}
示例11: AttackInfo
public AttackInfo(Coordinate coord, AttackResult result, bool sunkShip)
{
this.coord = coord;
this.result = result;
this.sunkShip = sunkShip;
}
示例12: UpdateAttackResults
public void UpdateAttackResults(Coordinate lastAttack, AttackResult result, bool sunkShip)
{
((MainWindow)wdw).Dispatcher.Invoke(new UpdateAttackResultsDelegate(wdw.UpdateAttackResults),
lastAttack, result, sunkShip);
}
示例13: CombatMessageFromResult
private static string CombatMessageFromResult(Unit source, Unit target, String skill, AttackResult attackResult, int damage)
{
var effectString = String.Empty;
switch (attackResult) {
case AttackResult.Hit:
effectString = String.Format("dealing {0} damage", damage);
break;
case AttackResult.Miss:
effectString = String.Format("but misses, dealing no damage.");
break;
case AttackResult.Critical:
effectString = String.Format("dealing a critical blow for {0} total damage!", damage);
break;
case AttackResult.Glancing:
effectString = String.Format("dealing {0} damage with a glancing attack", damage);
break;
}
return String.Format("{0} fires off a {1} at {2}, {3}.",
source.Name,
skill,
target.Name,
effectString);
}
示例14: Create
public static NumberItem Create(Vector3 worldPosition, AttackResult result)
{
NumberItem numberItem = DoCreate(worldPosition);
numberItem.Show(result);
return numberItem;
}
示例15: TotalDamageFromResult
private static int TotalDamageFromResult(AttackResult attackResult, int damage)
{
switch (attackResult) {
case AttackResult.Hit:
return damage;
case AttackResult.Miss:
return 0;
case AttackResult.Critical:
return damage * 2;
case AttackResult.Glancing:
return damage / 2;
}
return 0;
}