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


C# Character.CanSee方法代碼示例

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


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

示例1: CanBeUsedBy

		/// <summary>
		/// The unit who is currently using the GO
		/// </summary>
		//public Unit User
		//{
		//    get
		//    {
		//        return m_user;
		//    }
		//}

		/// <summary>
		/// Whether this GO can be used by the given user
		/// </summary>
		/// <param name="chr"></param>
		/// <returns></returns>
		public bool CanBeUsedBy(Character chr)
		{
			if (chr.GodMode)
			{
				return true;
			}

			// must be enabled
			if (!chr.CanSee(m_go) || m_go.State == GameObjectState.Disabled)
			{
				return false;
			}

			// must have the right Faction (if limited to either side)
			if (m_go.Faction != Faction.NullFaction && m_go.Faction.Group != chr.Faction.Group)
			{
				return false;
			}

			// Check for Group-requirements
			if (m_go.Entry.IsPartyOnly && m_go.Owner != null && !m_go.Owner.IsAlliedWith(chr))
			{
				return false;
			}

			var unit = chr;
			if (!unit.IsAlive)
			{
				return false;
			}
			if (!unit.CanInteract)
			{
				return false;
			}

			return m_go.IsInRadiusSq(chr, GOMgr.DefaultInteractDistanceSq);
			// && m_go.IsInFrontOf(obj);
		}
開發者ID:WCellFR,項目名稱:WCellFR,代碼行數:54,代碼來源:GameObjectHandler.cs

示例2: CheckVendorInteraction

        /// <summary>
        /// Also sends a message to the Character, if not valid
        /// </summary>
        internal bool CheckVendorInteraction(Character chr)
        {
            if (chr.Map != m_Map ||
                !IsInRadiusSq(chr, NPCMgr.DefaultInteractionDistanceSq) ||
                !chr.CanSee(this))
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.TooFarAway);
                return false;
            }

            if (!IsAlive)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.VendorDead);
                return false;
            }

            if (chr.IsAlive == IsSpiritHealer)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.YouDead);
                return false;
            }

            if (!chr.CanInteract || !CanInteract)
            {
                return false;
            }

            var reputation = chr.Reputations.GetOrCreate(Faction.ReputationIndex);
            if (reputation != null && !reputation.CanInteract)
            {
                NPCHandler.SendNPCError(chr, this, VendorInventoryError.BadRep);
                return false;
            }

            return true;
        }
開發者ID:ebakkedahl,項目名稱:WCell,代碼行數:39,代碼來源:NPC.cs

示例3: CanInteractWith

		public bool CanInteractWith(Character chr)
		{
			if (chr.Region != m_region ||
				!IsInRadiusSq(chr, NPCMgr.DefaultInteractionDistanceSq) ||
				!chr.CanSee(this))
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.TooFarAway);
				return false;
			}

			if (chr.IsAlive == IsSpiritHealer)
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.YouDead);
				return false;
			}

			if (chr.IsOnTaxi || m_isInCombat || IsOnTaxi)
			{
				return false;
			}

			if (!chr.CanInteract || !CanInteract)
			{
				return false;
			}

			var reputation = chr.Reputations.GetOrCreate(Faction.ReputationIndex);
			if (reputation != null && !reputation.CanInteract)
			{
				NPCHandler.SendNPCError(chr, this, VendorInventoryError.BadRep);
				return false;
			}

			return true;
		}
開發者ID:WCellFR,項目名稱:WCellFR,代碼行數:35,代碼來源:NPC.cs


注:本文中的WCell.RealmServer.Entities.Character.CanSee方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。