本文整理汇总了C#中NPC.Initialize方法的典型用法代码示例。如果您正苦于以下问题:C# NPC.Initialize方法的具体用法?C# NPC.Initialize怎么用?C# NPC.Initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NPC
的用法示例。
在下文中一共展示了NPC.Initialize方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Activate
public override void Activate(bool instancePreserved)
{
IsoTileMap world;
Camera camera;
if (!instancePreserved)
{
Color myColor = Color.FromNonPremultiplied(255, 10, 10, 128);
Console.WriteLine(myColor);
ContentManager content = ScreenManager.Game.Content;
manager = GameManager.Instance;
manager.InMultiplayer = false;
escapePressed = new InputAction(null, new Keys[] { Keys.Escape }, true);
uPressed = new InputAction(null, new Keys[] { Keys.U }, true);
// Called when the screen is first activated.. can initialize here
camera = new Camera(ScreenManager.Game);
camera.Autonomous = false;
manager.Camera = camera;
world = new IsoTileMap(camera);
world.Cursor.Active = true;
world.Cursor.Colour = Color.Blue;
world.LoadFromFile(content, "Content/Maps/MPMap.map");
scorebg = content.Load<Texture2D>("UITextures/scorebg");
scoreFont = content.Load<SpriteFont>("Fonts/GUIFont");
gameOverFont = content.Load<SpriteFont>("Fonts/GameOverFont");
world.SetCameraToWorldBounds();
manager.TileMap = world;
// Set up a fresh game state
GameManager.Instance.GameState = new GameState(GameManager.Instance);
manager.GameState.Characters = new Character[26];
Character playerChar = new Character(manager);
manager.GameState.Characters[0] = playerChar;
playerChar.Initialize(1, new Vector2(350, 350));
playerChar.IsPlayer = true;
player = playerChar;
characters.Add(playerChar);
actionBar = new ActionBar(player);
playerFrame = new PlayerFrame(player);
playerChar.Team = Team.BLUE;
player.CurrentFocus = 25;
player.CurrentHealth = 100;
player.CrystalCount = 500;
manager.MyID = 0;
for (int i = 1; i < 26; i++)
{
NPC c = new NPC(manager);
manager.GameState.Characters[i] = c;
bool canPlace = false;
Vector2 pos = Vector2.Zero;
while (!canPlace)
{
int xPos = randomizer.Next(32, manager.TileMap.GetWidthInPixels() - 32);
int yPos = randomizer.Next(32, manager.TileMap.GetHeightInPixels() - 32);
pos = new Vector2(xPos, yPos);
if ((pos - manager.GameState.Characters[0].WorldPosition).Length() > 1000)
{
canPlace = true;
}
}
c.Initialize(randomizer.Next(0, 4), pos);
}
/*
NPC char1 = new NPC(manager);
char1.Initialize(0, new Vector2(450, 350));
characters.Add(char1);
char1.Name = "Player1";
NPC char2 = new NPC(manager);
char2.Initialize(1, new Vector2(550, 350));
characters.Add(char2);
char2.Name = "Player2";
char2.Team = Team.RED;
char2.CurrentHealth = char2.MaxHealth / 2;
NPC char3 = new NPC(manager);
char3.Initialize(2, new Vector2(650, 350));
characters.Add(char3);
char3.Name = "Player3";
NPC char4 = new NPC(manager);
char4.Initialize(3, new Vector2(750, 350));
characters.Add(char4);
char4.Name = "Player4";
char4.Team = Team.RED;
char4.CurrentHealth = char2.MaxHealth / 2;
*/
/*
Random randomizer = new Random();
for (int i = 0; i < 20; i++)
{
//.........这里部分代码省略.........