using FishNet.Connection;
using FishNet.Observing;
using UnityEngine;
namespace FishNet.Component.Observing
{
///
/// This condition makes an object only visible to the owner.
///
[CreateAssetMenu(menuName = "FishNet/Observers/Owner Only Condition", fileName = "New Owner Only Condition")]
public class OwnerOnlyCondition : ObserverCondition
{
///
/// Returns if the object which this condition resides should be visible to connection.
///
/// Connection which the condition is being checked for.
/// True if the connection currently has visibility of this object.
/// True if the condition was not processed. This can be used to skip processing for performance. While output as true this condition result assumes the previous ConditionMet value.
public override bool ConditionMet(NetworkConnection connection, bool currentlyAdded, out bool notProcessed)
{
notProcessed = false;
/* Returning false immediately indicates no connection will
* meet this condition. */
return false;
}
///
/// True if the condition requires regular updates.
///
///
public override bool Timed()
{
return false;
}
///
/// Clones referenced ObserverCondition. This must be populated with your conditions settings.
///
///
public override ObserverCondition Clone()
{
OwnerOnlyCondition copy = ScriptableObject.CreateInstance();
return copy;
}
}
}