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


C# Actor.TraitsImplementing方法代码示例

本文整理汇总了C#中OpenRA.Actor.TraitsImplementing方法的典型用法代码示例。如果您正苦于以下问题:C# Actor.TraitsImplementing方法的具体用法?C# Actor.TraitsImplementing怎么用?C# Actor.TraitsImplementing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenRA.Actor的用法示例。


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

示例1: Add

 public void Add(World w, Actor a)
 {
     actors.Add(a);
     foreach (var sel in a.TraitsImplementing<INotifySelected>())
         sel.Selected(a);
     foreach (var ns in w.WorldActor.TraitsImplementing<INotifySelection>())
         ns.SelectionChanged();
 }
开发者ID:RunCraze,项目名称:OpenRA,代码行数:8,代码来源:Selection.cs

示例2: Player

        public Player(World world, Session.Client client, Session.Slot slot, PlayerReference pr)
        {
            World = world;
            InternalName = pr.Name;
            PlayerReference = pr;
            string botType = null;

            // Real player or host-created bot
            if (client != null)
            {
                ClientIndex = client.Index;
                ColorRamp = client.ColorRamp;
                PlayerName = client.Name;
                botType = client.Bot;
                Country = ChooseCountry(world, client.Country);
            }
            else
            {
                // Map player
                ClientIndex = -1; // Owned by the host (todo: fix this)
                ColorRamp = pr.ColorRamp;
                PlayerName = pr.Name;
                NonCombatant = pr.NonCombatant;
                botType = pr.Bot;
                Country = ChooseCountry(world, pr.Race);
            }
            PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });
            Shroud = PlayerActor.Trait<Shroud>();
            Shroud.Owner = this;
            // Enable the bot logic on the host
            IsBot = botType != null;
            if (IsBot && Game.IsHost)
            {
                var logic = PlayerActor.TraitsImplementing<IBot>()
                            .FirstOrDefault(b => b.Info.Name == botType);
                if (logic == null)
                    Log.Write("debug", "Invalid bot type: {0}", botType);
                else
                    logic.Activate(this);
            }
        }
开发者ID:VrKomarov,项目名称:OpenRA,代码行数:41,代码来源:Player.cs

示例3: Player

		public Player(World world, Session.Client client, PlayerReference pr)
		{
			string botType;

			World = world;
			InternalName = pr.Name;
			PlayerReference = pr;

			// Real player or host-created bot
			if (client != null)
			{
				ClientIndex = client.Index;
				Color = client.Color;
				PlayerName = client.Name;
				botType = client.Bot;
				Faction = ChooseFaction(world, client.Faction, !pr.LockFaction);
				DisplayFaction = ChooseDisplayFaction(world, client.Faction);
			}
			else
			{
				// Map player
				ClientIndex = 0; // Owned by the host (TODO: fix this)
				Color = pr.Color;
				PlayerName = pr.Name;
				NonCombatant = pr.NonCombatant;
				Playable = pr.Playable;
				Spectating = pr.Spectating;
				botType = pr.Bot;
				Faction = ChooseFaction(world, pr.Faction, false);
				DisplayFaction = ChooseDisplayFaction(world, pr.Faction);
			}

			PlayerActor = world.CreateActor("Player", new TypeDictionary { new OwnerInit(this) });
			Shroud = PlayerActor.Trait<Shroud>();

			fogVisibilities = PlayerActor.TraitsImplementing<IFogVisibilityModifier>().ToArray();

			// Enable the bot logic on the host
			IsBot = botType != null;
			if (IsBot && Game.IsHost)
			{
				var logic = PlayerActor.TraitsImplementing<IBot>().FirstOrDefault(b => b.Info.Name == botType);
				if (logic == null)
					Log.Write("debug", "Invalid bot type: {0}", botType);
				else
					logic.Activate(this);
			}
		}
开发者ID:Roger-luo,项目名称:OpenRA,代码行数:48,代码来源:Player.cs

示例4: CanViewActor

        public bool CanViewActor(Actor a)
        {
            if (a.TraitsImplementing<IVisibilityModifier>().Any(t => !t.IsVisible(a, this)))
                return false;

            return a.Trait<IDefaultVisibility>().IsVisible(a, this);
        }
开发者ID:rhamilton1415,项目名称:OpenRA,代码行数:7,代码来源:Player.cs


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