本文整理汇总了C#中Game类的典型用法代码示例。如果您正苦于以下问题:C# Game类的具体用法?C# Game怎么用?C# Game使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Game类属于命名空间,在下文中一共展示了Game类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewGame
//Method to be re written when serialisation/deserialisation implemented.
public Game NewGame(Player newPlayer)
{
Game game = new Game(newPlayer);
GameObject mayorSpawn = GameObject.Find("MayorSpawnLocation-Beach");
GameObject ethanSpawn = GameObject.Find("EthanSpawnLocation-Hut");
GameObject jennaSpawn = GameObject.Find("JennaSpawnPoint-forest");
GameObject fisherSpawn = GameObject.Find("FisherSpawnPoint-headland");
Npc mayor = new Npc("Mayor", "Mayor", mayorSpawn.transform.position, 1f, true);
Npc ethan = new Npc("Ethan", "Ethan", ethanSpawn.transform.position, 0.2f, true);
Npc jenna = new Npc("Jenna", "npc1", jennaSpawn.transform.position,0.3f, true);
Npc fisher = new Npc("Fisher", "fisher", fisherSpawn.transform.position,0f, false);
game.AddNpc(mayor);
game.AddNpc(ethan);
game.AddNpc(jenna);
game.AddNpc(fisher);
RecyclePoint beachPoint = new RecyclePoint("BeachRecyclePoint", 50);
game.RecyclePoints.Add(beachPoint);
game.CheckPoints.Add ("SpokenToMayorFirst");
game.CheckPoints.Add ("SpokenToEthan");
game.CheckPoints.Add ("FirstEthanMeetingPositive");
game.CheckPoints.Add ("MayorLeaveBeach");
game.CheckPoints.Add ("BeachRecyclePointFull");
game.CheckPoints.Add ("StartSortingMiniGame");
game.IsNewGame = false;
return game;
}
示例2: GameLoader
public GameLoader(string fileName, Assembly [] preloads, Action<string> die)
{
Game = new Game(this, die);
string extention = null;
try
{
extention = fileName.Substring(fileName.LastIndexOf('.'));
}
catch (Exception)
{
die("File " + fileName + " could Not be loaded");
return;
}
if (".kgl" == extention)
{
loaderUtility = new KGLLoaderUtility(fileName, this);
}
else
{
die("File " + fileName + " could Not be loaded");
}
foreach (Assembly loaded in preloads)
{
string name = Path.GetFileName(loaded.Location);
if (!LoadedFiles.ContainsKey(name))
{
LoadedFiles.Add(name, loaded);
ClassFactory.LoadServicesAndManagers(loaded);
}
}
}
示例3: Load
/// <summary>
///
/// </summary>
/// <param name="game"></param>
/// <param name="stream"></param>
/// <param name="requestedType"></param>
/// <param name="assetPath"></param>
/// <returns></returns>
public override object Load( Game game, Stream stream, Type requestedType, string assetPath )
{
var bytes = stream.ReadAllBytes();
if (assetPath.ToLowerInvariant().Contains("|default")) {
return Encoding.Default.GetString( bytes );
}
if (assetPath.ToLowerInvariant().Contains("|utf8")) {
return Encoding.UTF8.GetString( bytes );
}
if (assetPath.ToLowerInvariant().Contains("|utf7")) {
return Encoding.UTF7.GetString( bytes );
}
if (assetPath.ToLowerInvariant().Contains("|utf32")) {
return Encoding.UTF32.GetString( bytes );
}
if (assetPath.ToLowerInvariant().Contains("|ascii")) {
return Encoding.ASCII.GetString( bytes );
}
return Encoding.Default.GetString( bytes );
}
示例4: Update
/// <summary>
/// Handles the logical part of the scene
/// </summary>
/// <param name="game">Game manager</param>
public void Update(Game game)
{
// If any key was pressed
if (game.KeyboardManager.AnyTriggered != null)
// Goes back to the title scene
game.SceneManager.NextScene = new SceneTitle();
}
示例5: ElecticityUpdate
public static void ElecticityUpdate(Game game, Node center)
{
Node tmp = center;
int Volt = game.getScore();
int In = game.getScore();
ElectricityCalcul(tmp, ref Volt, In, true, tmp);
}
示例6: Start
void Start () {
CreatureCard c0 = new CreatureCard(3, 2, "Knight", 3, CardType.Creature, CardEffectName.Effect1, 0);
SpellCard c1 = new SpellCard("Horse", 3, CardType.Spell, CardEffectName.Effect1, 1);
SpellCard c2 = new SpellCard("Spearman", 1, CardType.Spell, CardEffectName.Effect1, 1);
CreatureCard c3 = new CreatureCard(2, 1, "Bishop", 2, CardType.Creature, CardEffectName.Effect1, 0);
CreatureCard c4 = new CreatureCard(2, 5, "King", 4, CardType.Creature, CardEffectName.Effect1, 0);
Game game = new Game(p1, p2);
p1.deck.Add(c1);
p1.deck.Add(c0);
p1.deck.Add(c2);
p1.deck.Add(c3);
p1.deck.Add(c4);
p1.deck.Add(c1);
p1.deck.Add(c0);
p1.deck.Add(c2);
p1.deck.Add(c3);
p2.deck.Add(c1);
p2.deck.Add(c0);
p2.deck.Add(c2);
p2.deck.Add(c3);
p2.deck.Add(c4);
p2.deck.Add(c1);
p2.deck.Add(c0);
p2.deck.Add(c2);
p2.deck.Add(c3);
ShuffleDeck(p1);
ShuffleDeck(p2);
}
示例7: Main
public static void Main(string[] args)
{
bool fullscreen = false;
string sc_cd_dir = ConfigurationManager.AppSettings["StarcraftCDDirectory"];
string bw_cd_dir = ConfigurationManager.AppSettings["BroodwarCDDirectory"];
/* catch this pathological condition where someone has set the cd directories to the same location. */
if (sc_cd_dir != null && bw_cd_dir != null && bw_cd_dir == sc_cd_dir) {
Console.WriteLine ("The StarcraftCDDirectory and BroodwarCDDirectory configuration settings must have unique values.");
return;
}
// I am a bad hacker for doing this on !OSX
try {
NSApplicationLoad ();
} catch {}
Game g = new Game (ConfigurationManager.AppSettings["StarcraftDirectory"],
sc_cd_dir, bw_cd_dir);
if (args.Length > 0)
if (args[0] == "/fullscreen")
fullscreen = true;
g.Startup(fullscreen);
}
示例8: EnemyCollection
public EnemyCollection(ref Texture2D texture,Vector2 Position, Rectangle rect, Game game) : base(game)
{
this.Texture = texture;
this.Rectangle = rect;
this.Position = Position;
this.game = game;
}
示例9: Inscribe
public static void Inscribe(Game.ConquerStructures.Society.ArsenalType Type, uint Donation, Interfaces.IConquerItem item, Game.Entity Entity)
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
cmd.Insert("guild_arsenalsdonation").Insert("d_uid", Entity.UID).Insert("guild_uid", Entity.GuildID).Insert("name", Entity.Name).Insert("item_uid", item.UID).Insert("item_donation", Donation).Insert("item_arsenal_type", (byte)Type).Execute();
cmd = new MySqlCommand(MySqlCommandType.UPDATE);
cmd.Update("items").Set("Inscribed", 1).Where("UID", item.UID).Execute();
}
示例10: CreateArsenal
public static void CreateArsenal(ushort gID, Game.ConquerStructures.Society.ArsenalType Type)
{
if (!ContainsArsenal(gID))
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT);
cmd.Insert("guild_arsenals").Insert("guild_uid", gID).Execute();
}
else
{
string val = "";
switch (Type)
{
case ArsenalType.Headgear: val = "head_allowed"; break;
case ArsenalType.Armor: val = "armor_allowed"; break;
case ArsenalType.Weapon: val = "weapon_allowed"; break;
case ArsenalType.Ring: val = "ring_allowed"; break;
case ArsenalType.Boots: val = "boots_allowed"; break;
case ArsenalType.Necklace: val = "neck_allowed"; break;
case ArsenalType.Fan: val = "fan_allowed"; break;
case ArsenalType.Tower: val = "tower_allowed"; break;
}
if (val != "")
{
MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE);
cmd.Update("guild_arsenals").Set(val, 1).Execute();
}
}
}
示例11: Mouse
/// <summary>
///
/// </summary>
/// <param name="Game"></param>
internal Mouse ( Game Game ) : base(Game)
{
this.device = Game.InputDevice;
device.MouseScroll += device_MouseScroll;
device.MouseMove += device_MouseMove;
}
示例12: MemorySecret
/// <summary>
/// Initializes a new instance of the <see cref="MemorySecret"/> class with
/// the specified values.
/// </summary>
/// <param name="game">The game.</param>
/// <param name="gameId">The game id.</param>
/// <param name="memory">The memory.</param>
/// <param name="isReturnSecret">if set to <c>true</c> is return secret.</param>
public MemorySecret(Game game, short gameId, Memory memory, bool isReturnSecret)
{
GameID = gameId;
TargetGame = game;
Memory = memory;
IsReturnSecret = isReturnSecret;
}
示例13: CollideHor
bool CollideHor( Game game, byte block )
{
Vector3 min = game.BlockInfo.MinBB[block] + FloorHor( Position );
Vector3 max = game.BlockInfo.MaxBB[block] + FloorHor( Position );
return Position.X >= min.X && Position.Z >= min.Z &&
Position.X < max.X && Position.Z < max.Z;
}
示例14: Tick
protected bool Tick( Game game, float gravity, double delta )
{
hitTerrain = false;
lastPos = Position = nextPos;
byte curBlock = GetBlock( game, (int)Position.X, (int)Position.Y, (int)Position.Z );
float minY = Utils.Floor( Position.Y ) + game.BlockInfo.MinBB[curBlock].Y;
float maxY = Utils.Floor( Position.Y ) + game.BlockInfo.MaxBB[curBlock].Y;
if( !CanPassThrough( game, curBlock ) && Position.Y >= minY &&
Position.Y < maxY && CollideHor( game, curBlock ) )
return true;
Velocity.Y -= gravity * (float)delta;
int startY = (int)Math.Floor( Position.Y );
Position += Velocity * (float)delta * 3;
int endY = (int)Math.Floor( Position.Y );
if( Velocity.Y > 0 ) {
// don't test block we are already in
for( int y = startY + 1; y <= endY && TestY( game, y, false ); y++ );
} else {
for( int y = startY; y >= endY && TestY( game, y, true ); y-- );
}
nextPos = Position;
Position = lastPos;
return base.Tick( game, delta );
}
示例15: AnyLiveCellWithFewerThanTwoLiveNeighboursDies
public void AnyLiveCellWithFewerThanTwoLiveNeighboursDies()
{
var game = new Game(3);
game.Tick();
Assert.False(game.NextLife[2, 0].IsAlive);
}