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


C# Race类代码示例

本文整理汇总了C#中Race的典型用法代码示例。如果您正苦于以下问题:C# Race类的具体用法?C# Race怎么用?C# Race使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Race类属于命名空间,在下文中一共展示了Race类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LateUpdate

    void LateUpdate()
    {
        if (enabled && Network.isServer)
        {
            var lSceneManager = GameSceneManager.Singleton;

            if (race == Race.eNone && owner)
                race = PlayerInfo.getRace(owner.layer);

            //有race,则只优化敌队的传输
            if (race == Race.ePismire)
                addTo(lSceneManager.getManager(Race.eBee,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            else if (race == Race.eBee)
                addTo(lSceneManager.getManager(Race.ePismire,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            else
            {
            //将自己增加到英雄的BoundNetworkScope中
                addTo(lSceneManager.getManager(Race.ePismire,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
                addTo(lSceneManager.getManager(Race.eBee,
                    GameSceneManager.UnitManagerType.heroSpawn).managerRoot);
            }

        }
        enabled = false;
    }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:28,代码来源:NetworkScopeObject.cs

示例2: buildRace

    public void buildRace(Race pRace)
    {
        if (Network.isServer)
        {
            var lViewID = Network.AllocateViewID();
            var lIntRace = (int)pRace;
            StrongholdSetBuilding(lViewID, lIntRace);
            networkView.RPC("StrongholdSetBuilding", RPCMode.Others, lViewID, lIntRace);
            networkView.enabled = false;
            //if (occupied)
            //{
            //    Debug.LogError("buildRace occupied");
            //    return;
            //}
            //strongholdBuilding = zzCreatorUtility
            //    .Instantiate(getBuilding(pRace), transform.position, transform.rotation, 0);
            //sendMessageWhenDie lSendMessageWhenDie
            //    = strongholdBuilding.GetComponent<sendMessageWhenDie>();
            //lSendMessageWhenDie.messageReceiver = gameObject;
            //owner = pRace;

            //if (Network.peerType != NetworkPeerType.Disconnected)
            //    networkView.RPC("RPCBuildRace", RPCMode.Others,
            //        strongholdBuilding.networkView.viewID, (int)owner);
            //networkView.enabled = false;
            //occupiedEvent();
            //raceChangedEvent(pRace);
        }
        else if (Network.peerType== NetworkPeerType.Disconnected)
        {
            setBuilding((GameObject)Instantiate(getBuilding(pRace)), pRace);
        }
    }
开发者ID:Seraphli,项目名称:TheInsectersWar,代码行数:33,代码来源:Stronghold.cs

示例3: EnsureLoaded

        private void EnsureLoaded()
        {
            using (new ReaderLock(_lock))
            {
                if (_loaded) return;

                using (new WriterLock(_lock))
                {
                    if (_loaded) return;

                    if (null == _cache)
                        _cache = new List<Race>();

                    Connection.ExecuteSql(new Query(RACE_SELECT), delegate(SqlDataReader reader)
                    {
                        while (reader.Read())
                        {
                            if (null != _cache.Find(c => reader[0].ToString() == c.Name))
                                return;

                            var newRace = new Race()
                            {
                                Name = reader[0].ToString()
                            };

                            _cache.Add(newRace);
                        }
                    });

                    _loaded = true;
                }
            }
        }
开发者ID:anxkha,项目名称:DRM,代码行数:33,代码来源:RaceStore.cs

示例4: GetNextFiishPosition_PlayersExist_ReturnsExpectedFinishPosition

        public void GetNextFiishPosition_PlayersExist_ReturnsExpectedFinishPosition()
        {
            var race = new Race();
            race.CreatePlayers(new Character[3] { Character.Mario, Character.Luigi, Character.Peach });

            race.GetNextFinishPosition().Should().Be(1);
        }
开发者ID:shealey,项目名称:CodeKatas,代码行数:7,代码来源:RaceTests.cs

示例5: GetNextFinishPosition_PlayersIsNull_ThrowsArgumentNullException

        public void GetNextFinishPosition_PlayersIsNull_ThrowsArgumentNullException()
        {
            var race = new Race();

            Action action = () => race.GetNextFinishPosition();
            action.ShouldThrow<ArgumentException>().And.Message.Contains("No Players created");
        }
开发者ID:shealey,项目名称:CodeKatas,代码行数:7,代码来源:RaceTests.cs

示例6: _testSimple

        private IEnumerable<RaceControl<string>> _testSimple(Race<string> race)
        {
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);
            int nId = Thread.CurrentThread.ManagedThreadId;

            yield return race.RunAs("x");
            Console.WriteLine("Should be in x");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);

            int xId = Thread.CurrentThread.ManagedThreadId;
            Assert.AreNotEqual(nId, xId);

            yield return race.RunAs("y");
            Console.WriteLine("Should be in y");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);

            int yId = Thread.CurrentThread.ManagedThreadId;
            Assert.AreNotEqual(nId, yId);
            Assert.AreNotEqual(xId, nId);

            yield return race.RunAs("x");
            Console.WriteLine("Should be in x again");
            Console.WriteLine("operation called on thread {0}, name '{1}'", Thread.CurrentThread.ManagedThreadId,
                              Thread.CurrentThread.Name);
            Assert.AreEqual(Thread.CurrentThread.ManagedThreadId, xId);
        }
开发者ID:lcorneliussen,项目名称:Braindrops,代码行数:29,代码来源:RaceTest.cs

示例7: Create_World_And_Hexes

        public void Create_World_And_Hexes()
        {
            var race = new Race { Name = "Default Race" };
            var nation = new Nation { Name = "Default Nation", Race = race };
            var user = new User { Email = "[email protected]", FirstName = "Jamie", LastName = "Fraser", OpenId = "http://jamief00.myopenid.com/" };
            var world = new World { Height = 100, Width = 100, Name = "Default World" };
            var game = new Game { Name = "Default Game", Started = DateTime.Now, GameWorld = world};
            var gameSession = new GameSession { EnteredGame = DateTime.Now, Nation = nation, Game = game, User = user };

            using (var tran = _dataContext.WorldRepository.Session.BeginTransaction())
            {
                _dataContext.RaceRepository.Save(race);
                _dataContext.NationRepository.Save(nation);
                _dataContext.UserRepository.Save(user);
                _dataContext.GameRepository.Save(game);
                _dataContext.WorldRepository.Save(world);
                _dataContext.GameSessionRepository.Save(gameSession);

                for (var y = 1; y <= world.Width; y++)
                {
                    for (var x = 1; x <= world.Height; x++)
                    {
                        var hex = new Hex { World = world, HexType = HexType.Grass, X = x, Y = y };

                        _dataContext.HexRepository.Save(hex);
                    }
                }

                tran.Commit();
            }
        }
开发者ID:Think-Jumper,项目名称:everland,代码行数:31,代码来源:WorldTests.cs

示例8: StartNewCampaign

      private void StartNewCampaign(Race setRace)
      {
         Campaign campaign = new Campaign(setRace);
         campaign.StartNew();

         MainGame.WinWarGame.SetNextGameScreen(new LevelGameScreen(campaign));
      }
开发者ID:CAMongrel,项目名称:WinWar,代码行数:7,代码来源:ChooseCampaignWindow.cs

示例9: Character

    public Character(Class cClass, Race cRace)
    {
        GameState.Instance.Character = this;
        //Assign character race + class
        charClass = cClass;
        charRace = cRace;

        //Create the player object
        this.Player = (GameObject)GameObject.Instantiate(Resources.Load("Player"));
        //Create the camera object
        this.camera = (GameObject)GameObject.Instantiate(Resources.Load("Camera"));
        //Create minimap camera object
        this.miniMap = (GameObject)GameObject.Instantiate(Resources.Load("MiniMapCam"));

        Cam cam = this.camera.AddComponent<Cam>();
        cam.target = this.Player;

        Cam camMini = this.miniMap.AddComponent<Cam>();
        camMini.target = this.Player;

        Health = MaxHealth;

        UIMain.SetCharLevel();
        UIMain.SetExp();
        UIMain.SetHealth();
        UIMain.SetLevel();
        UIMain.SetCharLevel();

        this.CharClass.Init();
    }
开发者ID:stijnhero,项目名称:Game,代码行数:30,代码来源:Character.cs

示例10: RaceAnalyzer

 private RaceAnalyzer(Race race)
 {
     _race = race;
     _analyzers.Add(new HeaderAnalyst() {Race = race});
     _analyzers.Add(new FirstTimesAnalyst() { Race = race });
     _analyzers.Add(new LayoffAnalyst() { Race = race });
 }
开发者ID:jpazarzis,项目名称:hogar,代码行数:7,代码来源:RaceAnalyzer.cs

示例11: CharacterCreateMenu

        public CharacterCreateMenu(WSOGame theGame, Client theClient)
        {
            myGame = theGame;
            netClient = theClient;

            characterRace = Race.Human;
            hairStyleID = 0;
            hairColorID = 0;
            faceStyleID = 0;
            shirtStyleID = 0;
            shirtColorID = 0;
            legsStyleID = 0;
            legsColorID = 0;
            skinColorID = 0;

            spr_HeadSprite = myGame.graphicsManager.Heads[(byte)characterRace][hairStyleID];
            spr_TorsoSprite = myGame.graphicsManager.Torsos[(byte)characterRace][shirtStyleID];
            spr_LegsSprite = myGame.graphicsManager.Legs[(byte)characterRace][legsStyleID];
            spr_FootSprite = myGame.graphicsManager.Feet[(byte)characterRace][legsStyleID];
            spr_ArmsSprite = myGame.graphicsManager.Arms[(byte)characterRace][shirtStyleID];

            spr_Shadow = myGame.graphicsManager.Shadow;

            characterPosition = new Vector2(520, 431);

            characterSlot = 0;
        }
开发者ID:rillyboss,项目名称:Whispered-Scrolls-Online-Client,代码行数:27,代码来源:CharacterCreateMenu.cs

示例12: Item

        /// <summary>
        /// Base deserialization constructor.
        /// </summary>
        /// <param name="src"></param>
        internal Item(MarketGroup group, SerializableItem src)
            : this(src.ID, src.Name)
        {
            m_marketGroup = group;

            m_icon = src.Icon;
            m_race = src.Race;
            m_slot = src.Slot;
            m_family = src.Family;
            m_description = src.Description;

            m_metaLevel = src.MetaLevel;
            m_metaGroup = src.MetaGroup;

            m_reprocessing = new FastList<Material>(0);
            m_properties = new PropertiesCollection(src.Properties);

            // Skills prerequisites
            m_prerequisites = new FastList<StaticSkillLevel>((src.Prereqs != null ? src.Prereqs.Length : 0));
            if (src.Prereqs == null)
                return;

            foreach (var prereq in src.Prereqs)
            {
                m_prerequisites.Add(new StaticSkillLevel(prereq.ID, prereq.Level));
            }
        }
开发者ID:wow4all,项目名称:evemu_server,代码行数:31,代码来源:Item.cs

示例13: IngameMenuWindow

        internal IngameMenuWindow(Race setRace)
        {
            curRace = setRace;
             LevelGameScreen.Game.GamePaused = true;

             BackgroundColor = new Microsoft.Xna.Framework.Color (0.3f, 0.0f, 0.0f, 0.5f);

             //Width = background.Width;
             //Height = background.Height;

             UIResource res = WarFile.GetUIResource(setRace == Race.Humans ? 368 : 369);

             background = new UIImage(WWTexture.FromImageResource(WarFile.GetImageResource(res.BackgroundImageResourceIndex)));
             background.InitWithUIResource (res);
             AddComponent (background);

             background.X = 120;
             background.Y = 20;

             continueButton = (UIButton)background.Components [6];
             continueButton.OnMouseUpInside += closeButton_OnMouseUpInside;

             quitButton = (UIButton)background.Components [5];
             quitButton.OnMouseUpInside += quitButton_OnMouseUpInside;

             MouseCursor.State = MouseCursorState.Pointer;
        }
开发者ID:CAMongrel,项目名称:WinWar,代码行数:27,代码来源:IngameMenuWindow.cs

示例14: Apply

        public void Apply(Race race)
        {
            race.Horses.ForEach(horse => horse.NeuralNetworkOpinion = NeuralNetworkOpinion.NoOpinion);

            var map = new Dictionary<Horse, StarterInfo>();
            List<StarterInfo> starterInfoCollection = race.Horses.Select(horse => CreateStarterInfo(horse, map)).Where(si => null != si).ToList();

            int numberOfHorses = race.Horses.Count(h => h.Scratched == false);

            if (starterInfoCollection.Count <= (numberOfHorses * 0.7))
                return;

            var selections = GetSelections(starterInfoCollection);

            foreach (var horse in map.Keys)
            {
                horse.Votes = map[horse].Votes;
                if (null != selections.Find(si=>si==map[horse]))
                {
                    horse.NeuralNetworkOpinion = NeuralNetworkOpinion.IsABet;
                }
                else
                {
                    horse.NeuralNetworkOpinion = NeuralNetworkOpinion.NotABet;
                }
            }
        }
开发者ID:jpazarzis,项目名称:hogar,代码行数:27,代码来源:DetectWinnerNeuronNetwork.SelectionEngine.cs

示例15: TestFoo

 public void TestFoo()
 {
     using (var multi = new Race<string>())
     {
         multi.Execute(_testSimple);
     }
 }
开发者ID:lcorneliussen,项目名称:Braindrops,代码行数:7,代码来源:RaceTest.cs


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