Changeset 4752 for 2013/30


Ignore:
Timestamp:
2013-08-29 21:35:13 (6 years ago)
Author:
dezhidki
Message:
  • Muokattu AStarin debuggausta
  • Väritetty pelaajien pelinappuloita
Location:
2013/30/DenisZ/CastleMaster/CastleMaster
Files:
9 added
11 edited

Legend:

Unmodified
Added
Removed
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Ai/AStar.cs

    r4646 r4752  
    55using CastleMaster.World; 
    66using CastleMaster.Units.Mobs; 
     7using System.Diagnostics; 
    78 
    89namespace IsometricEngineTest.Ai 
     
    2627 
    2728#if DEBUG 
    28         private TimeSpan totalTime = TimeSpan.Zero; 
     29        private Stopwatch timer; 
    2930#endif 
    3031 
     
    3738 
    3839            TIRE_FIX = (1.0 + (MOVE_STRAIGHT / 1000.0)); 
     40 
     41#if DEBUG 
     42            timer = new Stopwatch(); 
     43#endif 
    3944        } 
    4045 
     
    6772 
    6873#if DEBUG 
    69             totalTime = TimeSpan.Zero; 
     74            timer.Reset(); 
    7075            Console.WriteLine("[START] From: [ " + xStart + ", " + zStart + " ] to : [ " + xEnd + ", " + zEnd + "]."); 
    7176#endif 
     
    121126        { 
    122127#if DEBUG 
    123             DateTime startTime = DateTime.Now; 
     128            TimeSpan lastTime = timer.Elapsed; 
     129            timer.Start(); 
    124130#endif 
    125131            calls++; 
     
    133139                { 
    134140#if DEBUG 
    135                     totalTime += DateTime.Now - startTime; 
    136                     Console.WriteLine("[PAUSE] Calls so far: " + calls + ". Time spent: " + ((DateTime.Now - startTime).TotalMilliseconds) + " ms."); 
     141                    timer.Stop(); 
     142                    Console.WriteLine("[PAUSE] Calls so far: " + calls + ". Time spent: " + ((timer.Elapsed - lastTime).TotalMilliseconds) + " ms."); 
    137143#endif 
    138144                    return; 
     
    143149                { 
    144150#if DEBUG 
    145                     totalTime += DateTime.Now - startTime; 
    146                     Console.WriteLine("[FAIL] No more open nodes! Calls: " + calls + ". Total time: " + totalTime.TotalMilliseconds + " ms."); 
     151                    timer.Stop(); 
     152                    Console.WriteLine("[FAIL] No more open nodes! Calls: " + calls + ". Total time: " + timer.Elapsed.TotalMilliseconds + " ms."); 
    147153#endif 
    148154                    canPathFind = false; 
     
    190196 
    191197#if DEBUG 
    192             totalTime += DateTime.Now - startTime; 
    193             Console.WriteLine("[FINISH] Calls: " + calls + ". Total time: " + totalTime.TotalMilliseconds + " ms."); 
     198            timer.Stop(); 
     199            Console.WriteLine("[FINISH] Calls: " + calls + ". Total time: " + timer.Elapsed.TotalMilliseconds + " ms."); 
    194200#endif 
    195201 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/CastleMaster.csproj

    r4749 r4752  
    9797    <Compile Include="Guis\GuiArmoryMenu.cs" /> 
    9898    <Compile Include="Guis\GuiDebug.cs" /> 
     99    <Compile Include="Guis\GuiInstructions.cs" /> 
    99100    <Compile Include="Guis\GuiMainScreen.cs" /> 
    100101    <Compile Include="Guis\GuiPlayer.cs" /> 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Entities/EntityArrow.cs

    r4646 r4752  
    1818        private float moveDir, pushPower; 
    1919        private int dirID, damage; 
    20         private Team enemyTeam; 
     20        private Team enemyTeam, attackerTeam; 
    2121        private Unit target, archer; 
    2222 
     
    3030            this.target = target; 
    3131            this.archer = archer; 
     32            this.attackerTeam = attackerTeam; 
    3233            enemyTeam = Game.GetEnemyTeam(attackerTeam); 
    3334            moveSpeed = 2.0F; 
     
    7677        public override void Render(RenderHelper renderer) 
    7778        { 
    78             renderer.Render(ScreenPos, 6, dirID, Resources.SPRITESHEET_RANGER, Viewport.ZOOM); 
     79            renderer.Render(ScreenPos, 6, dirID, attackerTeam.SpriteSheetRanger, Viewport.ZOOM); 
    7980        } 
    8081    } 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Game.cs

    r4751 r4752  
    105105        public static FastRandom Random { get; private set; } 
    106106 
    107         public static readonly Team TEAM1 = new Team("Team1", 0); 
    108         public static readonly Team TEAM2 = new Team("Team2", 1); 
     107        public static Team TEAM1 { get; private set; } 
     108        public static Team TEAM2 { get; private set; } 
    109109 
    110110        public Game() 
     
    233233 
    234234            Resources.LoadResources(Content, renderer); 
     235            TEAM1 = new Team("BLUE", 0, Resources.SPRITESHEET_WOODCUTTER_BLU, Resources.SPRITESHEET_WARRIOR_BLU, Resources.SPRITESHEET_RANGER_BLU); 
     236            TEAM2 = new Team("RED", 1, Resources.SPRITESHEET_WOODCUTTER_RED, Resources.SPRITESHEET_WARRIOR_RED, Resources.SPRITESHEET_RANGER_RED); 
    235237        } 
    236238 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Graphics/Resources.cs

    r4728 r4752  
    88        public static int SPRITESHEET_TILES { get; private set; } 
    99        public static int SPRITESHEET_ICONS { get; private set; } 
    10         public static int SPRITESHEET_WOODCUTTER { get; private set; } 
    11         public static int SPRITESHEET_WARRIOR { get; private set; } 
    12         public static int SPRITESHEET_RANGER { get; private set; } 
     10        public static int SPRITESHEET_WOODCUTTER_RED { get; private set; } 
     11        public static int SPRITESHEET_WARRIOR_RED { get; private set; } 
     12        public static int SPRITESHEET_RANGER_RED { get; private set; } 
     13        public static int SPRITESHEET_WOODCUTTER_BLU { get; private set; } 
     14        public static int SPRITESHEET_WARRIOR_BLU { get; private set; } 
     15        public static int SPRITESHEET_RANGER_BLU { get; private set; } 
    1316        public static int SPRITE_KING { get; private set; } 
    1417        public static int SPRITE_STORE { get; private set; } 
     
    2629            SPRITESHEET_TILES = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("tiles/tilesheet"), 32, 32)); 
    2730            SPRITESHEET_ICONS = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("misc/icons"), 16, 16)); 
    28             SPRITESHEET_WOODCUTTER = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/woodcutter"), 32, 32)); 
    29             SPRITESHEET_WARRIOR = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/warrior"), 32, 32)); 
    30             SPRITESHEET_RANGER = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/archer"), 32, 32)); 
     31            SPRITESHEET_WOODCUTTER_RED = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/red/woodcutter_red"), 32, 32)); 
     32            SPRITESHEET_WARRIOR_RED = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/red/warrior_red"), 32, 32)); 
     33            SPRITESHEET_RANGER_RED = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/red/archer_red"), 32, 32)); 
     34            SPRITESHEET_WOODCUTTER_BLU = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/blu/woodcutter_blu"), 32, 32)); 
     35            SPRITESHEET_WARRIOR_BLU = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/blu/warrior_blu"), 32, 32)); 
     36            SPRITESHEET_RANGER_BLU = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/blu/archer_blu"), 32, 32)); 
    3137            SPRITE_KING = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/king"), 160, 128)); 
    3238            SPRITE_ARMORY = renderer.RegisterSpriteSheet(new SpriteSheet(cm.Load<Texture2D>("mobs/armory"), 160, 98)); 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Guis/GuiMainScreen.cs

    r4728 r4752  
    2121 
    2222        private Game game; 
    23         private string[] optionsStart = { "Start", "Instructions", "Exit" }; 
     23        private string[] optionsStart = { "Start", "How to play", "Exit" }; 
    2424        private string[] optionsInGame = { "Continue", "Main menu", "Exit" }; 
    2525        private Action[] actionsStart, actionsInGame; 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Players/Team.cs

    r4550 r4752  
    1010        public string Name; 
    1111        public int ID; 
     12        public int SpriteSheetWoodcutter, SpriteSheetWarrior, SpriteSheetRanger; 
    1213 
    13         public Team(string name, int id) 
     14        public Team(string name, int id, int spriteSheetWoodcutter, int spriteSheetWarrior, int spriteSheetRanger) 
    1415        { 
    1516            Name = name; 
    1617            ID = id; 
     18            SpriteSheetWoodcutter = spriteSheetWoodcutter; 
     19            SpriteSheetWarrior = spriteSheetWarrior; 
     20            SpriteSheetRanger = spriteSheetRanger; 
    1721        } 
    1822 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobRanger.cs

    r4740 r4752  
    186186        { 
    187187            base.Render(renderer); 
    188             renderer.Render(ScreenPos, spriteX, dirID, Resources.SPRITESHEET_RANGER, colorizer, Viewport.ZOOM); 
     188            renderer.Render(ScreenPos, spriteX, dirID, Owner.Team.SpriteSheetRanger, colorizer, Viewport.ZOOM); 
    189189        } 
    190190    } 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWarrior.cs

    r4740 r4752  
    184184        { 
    185185            base.Render(renderer); 
    186             renderer.Render(ScreenPos, spriteX, dirID, Resources.SPRITESHEET_WARRIOR, colorizer, Viewport.ZOOM); 
     186            renderer.Render(ScreenPos, spriteX, dirID, Owner.Team.SpriteSheetWarrior, colorizer, Viewport.ZOOM); 
    187187        } 
    188188    } 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMaster/Units/Mobs/MobWoodcutter.cs

    r4694 r4752  
    142142        { 
    143143            base.Render(renderer); 
    144             renderer.Render(ScreenPos, currentSpriteX, dirID, Resources.SPRITESHEET_WOODCUTTER, colorizer, Viewport.ZOOM); 
     144            renderer.Render(ScreenPos, currentSpriteX, dirID, Owner.Team.SpriteSheetWoodcutter, colorizer, Viewport.ZOOM); 
    145145        } 
    146146    } 
  • 2013/30/DenisZ/CastleMaster/CastleMaster/CastleMasterContent/CastleMasterContent.contentproj

    r4728 r4752  
    133133    </Compile> 
    134134  </ItemGroup> 
     135  <ItemGroup> 
     136    <Compile Include="mobs\blu\archer_blu.png"> 
     137      <Name>archer_blu</Name> 
     138      <Importer>TextureImporter</Importer> 
     139      <Processor>TextureProcessor</Processor> 
     140    </Compile> 
     141    <Compile Include="mobs\blu\woodcutter_blu.png"> 
     142      <Name>woodcutter_blu</Name> 
     143      <Importer>TextureImporter</Importer> 
     144      <Processor>TextureProcessor</Processor> 
     145    </Compile> 
     146    <Compile Include="mobs\red\archer_red.png"> 
     147      <Name>archer_red</Name> 
     148      <Importer>TextureImporter</Importer> 
     149      <Processor>TextureProcessor</Processor> 
     150    </Compile> 
     151    <Compile Include="mobs\red\warrior_red.png"> 
     152      <Name>warrior_red</Name> 
     153      <Importer>TextureImporter</Importer> 
     154      <Processor>TextureProcessor</Processor> 
     155    </Compile> 
     156    <Compile Include="mobs\red\woodcutter_red.png"> 
     157      <Name>woodcutter_red</Name> 
     158      <Importer>TextureImporter</Importer> 
     159      <Processor>TextureProcessor</Processor> 
     160    </Compile> 
     161  </ItemGroup> 
     162  <ItemGroup> 
     163    <Compile Include="mobs\blu\warrior_blu.png"> 
     164      <Name>warrior_blu</Name> 
     165      <Importer>TextureImporter</Importer> 
     166      <Processor>TextureProcessor</Processor> 
     167    </Compile> 
     168  </ItemGroup> 
    135169  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    136170  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.