Esempio n. 1
0
 /// <summary>
 /// 可视性
 /// </summary>
 /// <param name="player"></param>
 /// <returns></returns>
 public bool CanBeViewedByPlayer(Player player)
 {
     foreach (var visibilityModifier in visibilityModifiers)
     {
         if (!visibilityModifier.IsVisible(this, player))
         {
             return(false);
         }
     }
     return(defaultVisibility.IsVisible(this, player));
 }
Esempio n. 2
0
        bool ShouldRender(DotState state, Player toPlayer)
        {
            // Hide the indicator if the owner trait is disabled
            if (trait.IsTraitDisabled)
            {
                return(false);
            }

            // Hide the indicator if no watchers are available
            if (!state.Watcher.Granted && !state.Watcher.GrantedAllies)
            {
                return(false);
            }

            // Hide the indicator if a frozen actor portrait is visible
            if (state.FrozenActor != null && state.FrozenActor.HasRenderables)
            {
                return(false);
            }

            // Hide the indicator if the unit appears to be owned by an allied player
            if (actor.EffectiveOwner != null && actor.EffectiveOwner.Owner != null &&
                toPlayer.IsAlliedWith(actor.EffectiveOwner.Owner))
            {
                return(false);
            }

            // Hide indicator if the actor wouldn't otherwise be visible if there wasn't fog
            foreach (var visibilityModifier in visibilityModifiers)
            {
                if (!visibilityModifier.IsVisible(actor, toPlayer))
                {
                    return(false);
                }
            }

            // Hide the indicator behind shroud
            if (!trait.Info.VisibleInShroud && !toPlayer.Shroud.IsExplored(actor.CenterPosition))
            {
                return(false);
            }

            return(!visibility.IsVisible(actor, toPlayer));
        }