當前位置: 首頁>>代碼示例>>C#>>正文


C# Actor.Trait方法代碼示例

本文整理匯總了C#中OpenRA.Actor.Trait方法的典型用法代碼示例。如果您正苦於以下問題:C# Actor.Trait方法的具體用法?C# Actor.Trait怎麽用?C# Actor.Trait使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenRA.Actor的用法示例。


在下文中一共展示了Actor.Trait方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: PathSearch

 public PathSearch(Actor self)
 {
     this.self = self;
     world = self.World;
     cellInfo = InitCellInfo();
     mobile = self.Trait<Mobile>();
     queue = new PriorityQueue<PathDistance>();
 }
開發者ID:mgatland,項目名稱:OpenRA,代碼行數:8,代碼來源:PathSearch.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;
                Color = client.Color;
                PlayerName = client.Name;
                botType = client.Bot;
                Country = ChooseCountry(world, client.Country);
            }
            else
            {
                // Map player
                ClientIndex = 0; // Owned by the host (TODO: fix this)
                Color = pr.Color;
                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>();

            // 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:Generalcamo,項目名稱: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.Trait方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。