当前位置: 首页>>代码示例>>C#>>正文


C# Troop.GetStatusTroopTileAnimationRectangle方法代码示例

本文整理汇总了C#中GameObjects.Troop.GetStatusTroopTileAnimationRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# Troop.GetStatusTroopTileAnimationRectangle方法的具体用法?C# Troop.GetStatusTroopTileAnimationRectangle怎么用?C# Troop.GetStatusTroopTileAnimationRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GameObjects.Troop的用法示例。


在下文中一共展示了Troop.GetStatusTroopTileAnimationRectangle方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawStoppedTroop

 private void DrawStoppedTroop(SpriteBatch spriteBatch, Point viewportSize, Troop troop)
 {
     Rectangle? nullable;
     Color white = Color.White;
     if ((this.screen.DrawingSelector && (troop.Status == TroopStatus.一般)) && 
         this.screen.Scenario.IsCurrentPlayer(troop.BelongedFaction) && !troop.Operated)
     {
         Point positionByPoint = this.screen.GetPositionByPoint(this.screen.SelectorStartPosition);
         Point point2 = this.screen.GetPositionByPoint(this.screen.MousePosition);
         Rectangle r = new Rectangle(
             Math.Min(point2.X, positionByPoint.X), Math.Min(point2.Y, positionByPoint.Y), 
             Math.Abs(point2.X - positionByPoint.X), Math.Abs(point2.Y - positionByPoint.Y));
         if (r.Contains(troop.Position))
         {
             white = Color.Blue;
         }
     }
     if (troop.CurrentOutburstKind == OutburstKind.愤怒)
     {
         white = Color.Red;
     }
     else if (troop.CurrentOutburstKind == OutburstKind.沉静)
     {
         white = Color.Green;
     }
     spriteBatch.Draw(troop.TroopTexture, this.mainMapLayer.Tiles[troop.Position.X, troop.Position.Y].Destination, new Rectangle?(troop.GetCurrentStopDisplayRectangle(troop.TroopTexture.Width / troop.CurrentAnimation.FrameCount)), white, 0f, Vector2.Zero, SpriteEffects.None, 0.7f);
     if (this.screen.SelectorTroops.HasGameObject(troop.ID))
     {
         nullable = null;
         spriteBatch.Draw(this.screen.Textures.TileFrameTextures[4], this.mainMapLayer.Tiles[troop.Position.X, troop.Position.Y].Destination, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.699f);
     }
     if (troop.Surrounding)
     {
         nullable = null;
         spriteBatch.Draw(this.screen.Textures.TileFrameTextures[4], this.mainMapLayer.Tiles[troop.Position.X, troop.Position.Y].Destination, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.699f);
     }
     if (troop.Status != TroopStatus.一般)
     {
         spriteBatch.Draw(troop.StatusTileAnimation.Texture, this.mainMapLayer.Tiles[troop.Position.X, troop.Position.Y].Destination, new Rectangle?(troop.GetStatusTroopTileAnimationRectangle(troop.StatusTileAnimation.Texture.Width / troop.StatusTileAnimation.FrameCount)), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.6998f);
     }
     if (troop.CurrentStunt != null)
     {
         spriteBatch.Draw(troop.StuntTileAnimation.Texture, this.mainMapLayer.Tiles[troop.Position.X, troop.Position.Y].Destination, new Rectangle?(troop.GetStuntTroopTileAnimationRectangle(troop.StuntTileAnimation.Texture.Width / troop.StuntTileAnimation.FrameCount)), Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.6998f);
     }
     if ((this.screen.CurrentTroop == troop) && (this.screen.UndoneWorks.Peek().Kind == UndoneWorkKind.ContextMenu))
     {
         foreach (Point point3 in troop.OffenceArea.Area)
         {
             if (this.mainMapLayer.TileInScreen(point3))
             {
                 nullable = null;
                 spriteBatch.Draw(this.screen.Textures.TileFrameTextures[2], this.mainMapLayer.Tiles[point3.X, point3.Y].Destination, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.7f);
             }
         }
     }
 }
开发者ID:skicean,项目名称:ZhongHuaSanGuoZhi,代码行数:56,代码来源:TroopLayer.cs


注:本文中的GameObjects.Troop.GetStatusTroopTileAnimationRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。