Class CapturePoint
Capture point interactable for PvP or general objective capture. Tracks ownership, capture progress, and objective state. Fires OnCaptured when a player successfully captures the point. Configured via a CapturePointTemplate ScriptableObject asset.
[RequireComponent(typeof(SceneObjectNamer))]
public class CapturePoint : Interactable, ISpawnable, ICapturePoint, IInteractable, ISceneObject
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourNetworkBehaviourCapturePoint
- Implements
- Inherited Members
-
NetworkBehaviour.IsSpawnedNetworkBehaviour.ComponentIndexNetworkBehaviour.NetworkObjectNetworkBehaviour.MAXIMUM_NETWORKBEHAVIOURSNetworkBehaviour.UNSET_NETWORKBEHAVIOUR_IDNetworkBehaviour.ToString()NetworkBehaviour.Reset()NetworkBehaviour.OnValidate()NetworkBehaviour.IsBehaviourReconcilingNetworkBehaviour.ClearReplicateCache()NetworkBehaviour.CreateReconcile()NetworkBehaviour.Reconcile_Reader<T>(PooledReader, ref T)NetworkBehaviour.OnStartServerCalledNetworkBehaviour.OnStartClientCalledNetworkBehaviour.OnStartNetwork()NetworkBehaviour.OnStopNetwork()NetworkBehaviour.OnOwnershipServer(NetworkConnection)NetworkBehaviour.OnSpawnServer(NetworkConnection)NetworkBehaviour.OnDespawnServer(NetworkConnection)NetworkBehaviour.OnStartClient()NetworkBehaviour.OnStopClient()NetworkBehaviour.OnOwnershipClient(NetworkConnection)NetworkBehaviour.ClearBuffedRpcs()NetworkBehaviour.ExcludeOwnerFromUnbufferedObserversRpcsNetworkBehaviour.IsClientOnlyNetworkBehaviour.IsServerOnlyNetworkBehaviour.IsHostNetworkBehaviour.IsClientNetworkBehaviour.IsServerNetworkBehaviour.IsDeinitializingNetworkBehaviour.NetworkManagerNetworkBehaviour.ServerManagerNetworkBehaviour.ClientManagerNetworkBehaviour.ObserverManagerNetworkBehaviour.TransportManagerNetworkBehaviour.TimeManagerNetworkBehaviour.SceneManagerNetworkBehaviour.PredictionManagerNetworkBehaviour.RollbackManagerNetworkBehaviour.NetworkObserverNetworkBehaviour.IsClientInitializedNetworkBehaviour.IsClientStartedNetworkBehaviour.IsClientOnlyInitializedNetworkBehaviour.IsClientOnlyStartedNetworkBehaviour.IsServerInitializedNetworkBehaviour.IsServerStartedNetworkBehaviour.IsServerOnlyInitializedNetworkBehaviour.IsServerOnlyStartedNetworkBehaviour.IsHostInitializedNetworkBehaviour.IsHostStartedNetworkBehaviour.IsOfflineNetworkBehaviour.IsNetworkedNetworkBehaviour.GetIsNetworked()NetworkBehaviour.IsManagerReconcilingNetworkBehaviour.ObserversNetworkBehaviour.IsOwnerNetworkBehaviour.IsControllerNetworkBehaviour.HasAuthorityNetworkBehaviour.OwnerNetworkBehaviour.OwnerIdNetworkBehaviour.ObjectIdNetworkBehaviour.LocalConnectionNetworkBehaviour.OwnerMatches(NetworkConnection)NetworkBehaviour.Despawn(GameObject, DespawnType?)NetworkBehaviour.Despawn(NetworkObject, DespawnType?)NetworkBehaviour.Despawn(DespawnType?)NetworkBehaviour.Spawn(GameObject, NetworkConnection, Scene)NetworkBehaviour.Spawn(NetworkObject, NetworkConnection, Scene)NetworkBehaviour.RemoveOwnership()NetworkBehaviour.GiveOwnership(NetworkConnection)NetworkBehaviour.GetInstance<T>()NetworkBehaviour.TryRegisterInstance<T>(T)NetworkBehaviour.UnregisterInstance<T>()NetworkBehaviour.CanLog(LoggingType)MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.nameObject.hideFlags
Fields
AchievementTemplate
Achievement to increment when a player captures this point.
public AchievementTemplate AchievementTemplate
Field Value
Template
Template defining capture parameters.
public CapturePointTemplate Template
Field Value
Properties
CaptureProgress
Current number of capture interactions applied toward the current capture attempt.
public int CaptureProgress { get; set; }
Property Value
CapturingCharacterID
Character ID of the player currently attempting to capture this point.
public long CapturingCharacterID { get; set; }
Property Value
OwnerCharacterID
Character ID of the player who currently owns this capture point. 0 means neutral.
public long OwnerCharacterID { get; set; }
Property Value
State
Current objective state of this capture point.
public ObjectiveState State { get; set; }
Property Value
Title
Display title shown above the capture point.
public override string Title { get; }
Property Value
TitleColor
Title color for the capture point UI label. Uses olive for a distinct PvP aesthetic.
public override Color TitleColor { get; }
Property Value
- Color
Methods
ApplyCapture(long)
Applies one capture interaction toward this point.
public bool ApplyCapture(long characterID)
Parameters
characterIDlongThe character attempting to capture.
Returns
- bool
True if capture completed, false if still in progress or contested.
Remarks
A rival interrupts rather than inherits. The previous version handed the running progress count to whoever touched the point last: it zeroed the count, then immediately set CapturingCharacterID to the newcomer and incremented, so an enemy arriving at a point someone else had almost taken simply continued from one. Worse, it set Contested and then overwrote it with Capturing before returning — the state never came to rest on Contested, so no observer could ever see a point as contested and the enum member was unreachable. An interrupting interaction now breaks the capture and stops there; the rival starts their own attempt on their next interaction.
The interrupt branch only fires while there is live progress to break. Once progress reaches zero — by capture, by decay, or by an interrupt — the captor is cleared too, so a stale ID cannot make an uncontested point read as contested.
CanInteract(IPlayerCharacter)
Returns true if the specified player character may interact with this object.
public override bool CanInteract(IPlayerCharacter character)
Parameters
characterIPlayerCharacterThe player character attempting to interact.
Returns
- bool
True if interaction is allowed, false otherwise.
Remarks
A pure question with no side effects. It used to stamp the character's interact rate-limit as part of answering, which made it unusable as a check: the scene server, the quest system and the client's input handler all call it, and each call silently consumed a limiter meant for one of the others. A quest accepted within the limiter's window of the interaction that opened the dialogue was refused by a debounce nobody intended to spend, and the refusal path sends nothing back — so the player saw a dead keypress. Spend the limiter explicitly with TryConsumeInteractRateLimit(IPlayerCharacter).
OnAwake()
Called when the object is awakened. Override to implement custom initialization logic.
public override void OnAwake()
OnStartServer()
Registers the scene object and starts the decay clock.
public override void OnStartServer()
OnStopServer()
Drops the decay clock when the server stops running this object.
public override void OnStopServer()
Remarks
ResetState(bool) covers the pooled despawn, but a capture point is normally placed in a scene rather than spawned, and a scene unload does not have to go through the pool. Both routes release through the same flag, so whichever arrives first wins and the second is a no-op.
ReadPayload(NetworkConnection, Reader)
Reads capture point state from the network payload.
public override void ReadPayload(NetworkConnection connection, Reader reader)
Parameters
connectionNetworkConnectionreaderReader
ResetState(bool)
Clears ownership and capture progress when this instance returns to the pool.
public override void ResetState(bool asServer)
Parameters
asServerboolTrue when the reset is for the server instance.
Remarks
All four fields are per-life state. Without this a recycled capture point comes back still owned by whoever held it in its previous life — and CanInteract(IPlayerCharacter) refuses the owner outright, so that player could never take it again.
WritePayload(NetworkConnection, Writer)
Writes capture point state to the network payload.
public override void WritePayload(NetworkConnection connection, Writer writer)
Parameters
connectionNetworkConnectionwriterWriter