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


C# Game类代码示例

本文整理汇总了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;
    }
开发者ID:ocoulson,项目名称:MScProjectUnity,代码行数:33,代码来源:GameManager.cs

示例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);
                }
            }
        }
开发者ID:kinectitude,项目名称:kinectitude,代码行数:33,代码来源:GameLoader.cs

示例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 );
        }
开发者ID:Annaero,项目名称:FusionFramework,代码行数:34,代码来源:StringLoader.cs

示例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();
 }
开发者ID:bmotamer,项目名称:tamagottagettemall,代码行数:11,代码来源:SceneGameover.cs

示例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);
 }
开发者ID:Haseo,项目名称:Electric-Potatoe-TD,代码行数:7,代码来源:ElectricityManager.cs

示例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);
	}
开发者ID:divinekoala,项目名称:CardGame,代码行数:33,代码来源:GameController.cs

示例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);
    }
开发者ID:kangaroo,项目名称:scsharp,代码行数:27,代码来源:scsharp.cs

示例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;
 }
开发者ID:MishaGubsky,项目名称:studies,代码行数:7,代码来源:EnemyCollection.cs

示例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();
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:7,代码来源:ArsenalsTable.cs

示例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();
         }
     }
 }
开发者ID:AiiMz,项目名称:PserverWork,代码行数:28,代码来源:ArsenalsTable.cs

示例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;
		}
开发者ID:demiurghg,项目名称:FusionEngine,代码行数:11,代码来源:Mouse.cs

示例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;
 }
开发者ID:kabili207,项目名称:zora-sharp,代码行数:15,代码来源:MemorySecret.cs

示例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;
 }
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:7,代码来源:CollidableParticle.cs

示例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 );
        }
开发者ID:Retatta,项目名称:ClassicalSharp,代码行数:26,代码来源:CollidableParticle.cs

示例15: AnyLiveCellWithFewerThanTwoLiveNeighboursDies

        public void AnyLiveCellWithFewerThanTwoLiveNeighboursDies()
        {
            var game = new Game(3);
            game.Tick();

            Assert.False(game.NextLife[2, 0].IsAlive);
        }
开发者ID:hemantksingh,项目名称:GameOfLife,代码行数:7,代码来源:GameTests.cs


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