本文整理汇总了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;
}
示例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);
}
}
示例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;
}
}
}
示例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);
}
示例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");
}
示例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);
}
示例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();
}
}
示例8: StartNewCampaign
private void StartNewCampaign(Race setRace)
{
Campaign campaign = new Campaign(setRace);
campaign.StartNew();
MainGame.WinWarGame.SetNextGameScreen(new LevelGameScreen(campaign));
}
示例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();
}
示例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 });
}
示例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;
}
示例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));
}
}
示例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;
}
示例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;
}
}
}
示例15: TestFoo
public void TestFoo()
{
using (var multi = new Race<string>())
{
multi.Execute(_testSimple);
}
}