Author: conkerjo
(2009/07/12 15:10) Over 2 years ago
25
LoadingScreen.Load(ScreenManager, false, null, new BackgroundScreen(),
26
new MainMenuScreen());
27
}
28
29
30
16
using AIDemos.GameClasses.Behaviors;
17
using Brains.Framework.Map;
18
using Brains.Framework.Utility;
19
using Brains.Framework.Locomotion;
20
namespace AIDemos.Screens.Demos
21
{
22
...
44
45
CenterCamOnMap();
46
47
48
ScreenManager.Game.ResetElapsedTime();
49
50
51
private void LoadAI()
52
53
_engine.CreateWorld(new DrawableWorld());
54
_engine.World.LoadMapDataFromTexture(
_engine.World.LoadMapDataFromTexture(content.Load<Texture2D>("DemoTextures/MAPDemo1"),
55
content.Load<Texture2D>("DemoTextures/MAPDemo1"),
32,
56
typeof(DrawableGrid));
57
58
59
//Find the marked green node
60
_endNode= _engine.World.Map.AllCells.First(
99
bool gamePadDisconnected = !gamePadState.IsConnected &&
98
100
input.GamePadWasConnected[playerIndex];
101
102
if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)
if (!gamePadDisconnected)
103
104
ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);
105
106
else
107
108
Vector2 mousPos = new Vector2(_currentMouse.X, _currentMouse.Y);
109
110
if (_currentMouse.LeftButton == ButtonState.Released &&
115
if (cell != null)
116
111
117
GameActor actor = new GameActor(cell.Position, 5);
112
118
actor.Locomotion = new Brains.Framework.Locomotion.LocomotionController();
113
actor.Locomotion = new LocomotionController();
119
actor.Locomotion.MaxSpeed = 50;
114
120
actor.Locomotion.MaxRotation = MathHelper.TwoPi;
121
131
126
132
127
133
128
129
130
base.HandleInput(input);
134
135
136
public override void Draw(GameTime gameTime)
137
138
139
140
141
142
143
144
164
actor.RootBehavior = _sequence;
160
165
161
166
162
163
167
168
169
170
MouseState _lastMouse;
public override void HandleInput(InputState input)
if (input == null)
throw new ArgumentNullException("input");
_lastMouse = _currentMouse;
122
_currentMouse = Mouse.GetState();
123
124
125
int playerIndex = (int)ControllingPlayer.Value;
KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];
GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];
96
97
Vector2 mapMousePos = mousPos + primitiveBatch.CameraPosition;
145
146
189
190
191
192
193
194
195
196
197
198
199
200
201
202
using AIDemos.GameClasses.Behaviors.Conditions;
using AIDemos.GameClasses.Behaviors.Decorators;
23
using Brains.Grouping;
using Brains.Framework.Grouping;
24
public class Demo7 : DemoGameScreen
171
172
173
PlayerIndex index;
if (input.IsNewKeyPress(Keys.PageDown, null, out index))
primitiveBatch.Zoom = 1f;
ScreenManager.AddScreen(new AIDemosPauseMenuScreen(), ControllingPlayer);
5
using Brains.Framework;
6
7
8
namespace Brains.Grouping
namespace Brains.Framework.Grouping
9
10
public class Group
11
4
using System.Text;
using Microsoft.Xna.Framework;
namespace Brains.Framework.Locomotion
/// <summary>
12
using Brains.Framework.Behaviors.PathFinding;
13
14
namespace Brains.Framework
15
public void AnotateMap()
799
798
800
Groups.Add(group.GroupID, group);
801
802
public Group GetGroup(int id)
803
804
return Groups[id];
{{{{_engine.World.LoadMapDataFromTexture(content.Load<Texture2D>("DemoTextures/MAPDemo1"),content.Load<Texture2D>("DemoTextures/MAPDemo1"),32,32,typeof(DrawableGrid));typeof(DrawableGrid));if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)if (!gamePadDisconnected){{ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{{{actor.Locomotion = new Brains.Framework.Locomotion.LocomotionController();if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)if (!gamePadDisconnected){{ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{{{if (input == null)throw new ArgumentNullException("input");int playerIndex = (int)ControllingPlayer.Value;KeyboardState keyboardState = input.CurrentKeyboardStates[playerIndex];GamePadState gamePadState = input.CurrentGamePadStates[playerIndex];bool gamePadDisconnected = !gamePadState.IsConnected &&input.GamePadWasConnected[playerIndex];if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected){ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{}if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected)if (!gamePadDisconnected){{ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected){ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{}if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected){ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{}using Brains.Framework.Grouping;{{if (input.IsPauseGame(ControllingPlayer) || gamePadDisconnected){ScreenManager.AddScreen(new PauseMenuScreen(), ControllingPlayer);}else{}{{{{{namespace Brains.Framework.Grouping{{{{using Brains.Framework.Grouping;{{using Brains.Framework.Grouping;{{{{{{{{