Click or drag to resize

ShieldTSource, TArgs Class

A resource pool that is used to protect another resource pool from getting drained. The shield intercepts the event and applies some of the change to itself, only letting part (or none at all) of the change get through. If the ProtectedTarget is not set, it will try to find a ResourcePoolTSource, TArgs on the same GameObject. Generic version of Shield in case you want type-safety. To be able to use this you should make a non-generic subclass.
Inheritance Hierarchy
SystemObject
  Object
    Component
      Behaviour
        MonoBehaviour
          Archon.SwissArmyLib.ResourceSystemResourcePoolBase
            Archon.SwissArmyLib.ResourceSystemResourcePoolTSource, TArgs
              Archon.SwissArmyLib.ResourceSystemShieldTSource, TArgs
                Archon.SwissArmyLib.ResourceSystemShield

Namespace:  Archon.SwissArmyLib.ResourceSystem
Assembly:  Archon.SwissArmyLib (in Archon.SwissArmyLib.dll) Version: 1.0.0.0 (1.0.0.0)
Syntax
C#
public class Shield<TSource, TArgs> : ResourcePool<TSource, TArgs>, 
	IEventListener<IResourcePreChangeEvent<TSource, TArgs>>, IEventListener<IResourceEvent<TSource, TArgs>>
Request Example View Source

Type Parameters

TSource

[Missing <typeparam name="TSource"/> documentation for "T:Archon.SwissArmyLib.ResourceSystem.Shield`2"]

TArgs

[Missing <typeparam name="TArgs"/> documentation for "T:Archon.SwissArmyLib.ResourceSystem.Shield`2"]

The ShieldTSource, TArgs type exposes the following members.

Constructors
  NameDescription
Public methodShieldTSource, TArgs
Initializes a new instance of the ShieldTSource, TArgs class
Top
Properties
  NameDescription
Public propertyAbsorptionFlat
Gets or sets the flat amount of removed resource that should be absorbed by the shield.
Public propertyAbsorptionScaling
Gets or sets the fraction of removed resource that should be absorbed by the shield.
Public propertyanimation Obsolete.

The Animation attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyaudio Obsolete.

The AudioSource attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertycamera Obsolete.

The Camera attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertycollider Obsolete.

The Collider attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertycollider2D Obsolete.

The Collider2D component attached to the object.

(Inherited from Component.)
Public propertyconstantForce Obsolete.

The ConstantForce attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyCurrent
Gets the current amount of resource in this pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyDefaultArgs
Gets the args to fallback on if no args is specified.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyDefaultSource
Gets the source to fallback on if no source is specified.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyEmptiesWithTarget
Gets or sets whether the shield should get fully drained when the target is empty.
Public propertyEmptyTillRenewed
Gets or sets whether adding resource should be disabled after the pool is completely empty, until it is renewed using Renew(TSource, TArgs, Boolean) again.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyenabled

Enabled Behaviours are Updated, disabled Behaviours are not.

(Inherited from Behaviour.)
Public propertygameObject

The game object this component is attached to. A component is always attached to a game object.

(Inherited from Component.)
Public propertyguiElement Obsolete. (Inherited from Component.)
Public propertyguiText Obsolete.

The GUIText attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyguiTexture Obsolete.

The GUITexture attached to this GameObject (Read Only). (null if there is none attached).

(Inherited from Component.)
Public propertyhideFlags

Should the object be hidden, saved with the scene or modifiable by the user?

(Inherited from Object.)
Public propertyhingeJoint Obsolete.

The HingeJoint attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyisActiveAndEnabled

Has the Behaviour had enabled called.

(Inherited from Behaviour.)
Public propertyIsEmpty
Gets whether the pool is completely empty.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyIsFull
Gets whether the pool is completely empty.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertylight Obsolete.

The Light attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyMax
Gets or sets the maximum amount of source that can be in this pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyname

The name of the object.

(Inherited from Object.)
Public propertynetworkView Obsolete.

The NetworkView attached to this GameObject (Read Only). (null if there is none attached).

(Inherited from Component.)
Public propertyparticleEmitter Obsolete.

The ParticleEmitter attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyparticleSystem Obsolete.

The ParticleSystem attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyPercentage
Gets a how full the resource is percentage-wise (0 to 1)
(Inherited from ResourcePoolTSource, TArgs.)
Public propertyProtectedTarget
Gets or sets the target that this shield should protect.
Public propertyrenderer Obsolete.

The Renderer attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyRenewsWithTarget
Gets or sets whether the shield should renew when the target does.
Public propertyrigidbody Obsolete.

The Rigidbody attached to this GameObject. (Null if there is none attached).

(Inherited from Component.)
Public propertyrigidbody2D Obsolete.

The Rigidbody2D that is attached to the Component's GameObject.

(Inherited from Component.)
Public propertyrunInEditMode

Allow a specific instance of a MonoBehaviour to run in edit mode (only available in the editor).

(Inherited from MonoBehaviour.)
Public propertytag

The tag of this game object.

(Inherited from Component.)
Public propertyTimeSinceEmpty
Get the (scaled) time since this pool was last empty.
(Inherited from ResourcePoolTSource, TArgs.)
Public propertytransform

The Transform attached to this GameObject.

(Inherited from Component.)
Public propertyuseGUILayout

Disabling this lets you skip the GUI layout phase.

(Inherited from MonoBehaviour.)
Top
Methods
  NameDescription
Public methodAdd(Single, Boolean)
Adds the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodAdd(Single, TSource, Boolean)
Adds the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodAdd(Single, TSource, TArgs, Boolean)
Adds the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Protected methodAwake
Called when the MonoBehaviour is added to a GameObject.
(Overrides ResourcePoolTSource, TArgsAwake.)
Public methodBroadcastMessage(String)

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

(Inherited from Component.)
Public methodBroadcastMessage(String, Object)

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

(Inherited from Component.)
Public methodBroadcastMessage(String, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

(Inherited from Component.)
Public methodBroadcastMessage(String, Object, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object or any of its children.

(Inherited from Component.)
Public methodCancelInvoke

Cancels all Invoke calls on this MonoBehaviour.

(Inherited from MonoBehaviour.)
Public methodCancelInvoke(String)

Cancels all Invoke calls with name methodName on this behaviour.

(Inherited from MonoBehaviour.)
Protected methodChange
Changes the resource amount by delta.
(Overrides ResourcePoolTSource, TArgsChange(Single, TSource, TArgs, Boolean).)
Public methodCompareTag

Is this game object tagged with tag ?

(Inherited from Component.)
Public methodEmpty(Boolean)
Completely empties the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodEmpty(TSource, Boolean)
Completely empties the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodEmpty(TSource, TArgs, Boolean)
Completely empties the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodEquals (Inherited from Object.)
Public methodFill(Boolean)
Fully fills the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodFill(Single, Boolean)
Fills the pool to the specified amount.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodFill(TSource, Boolean)
Fully fills the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodFill(Single, TSource, Boolean)
Fills the pool to the specified amount.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodFill(TSource, TArgs, Boolean)
Fully fills the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodFill(Single, TSource, TArgs, Boolean)
Fills the pool to the specified amount.
(Inherited from ResourcePoolTSource, TArgs.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetComponent(Type)

Returns the component of Type type if the game object has one attached, null if it doesn't.

(Inherited from Component.)
Public methodGetComponent(String)

Returns the component with name type if the game object has one attached, null if it doesn't.

(Inherited from Component.)
Public methodGetComponent``1 (Inherited from Component.)
Public methodGetComponentInChildren(Type)

Returns the component of Type type in the GameObject or any of its children using depth first search.

(Inherited from Component.)
Public methodGetComponentInChildren(Type, Boolean) (Inherited from Component.)
Public methodGetComponentInChildren``1 (Inherited from Component.)
Public methodGetComponentInChildren``1(Boolean) (Inherited from Component.)
Public methodGetComponentInParent(Type)

Returns the component of Type type in the GameObject or any of its parents.

(Inherited from Component.)
Public methodGetComponentInParent``1 (Inherited from Component.)
Public methodGetComponents(Type)

Returns all components of Type type in the GameObject.

(Inherited from Component.)
Public methodGetComponents(Type, ListComponent) (Inherited from Component.)
Public methodGetComponents``1 (Inherited from Component.)
Public methodGetComponents``1(ListUMP) (Inherited from Component.)
Public methodGetComponentsInChildren(Type)

Returns all components of Type type in the GameObject or any of its children.

(Inherited from Component.)
Public methodGetComponentsInChildren(Type, Boolean)

Returns all components of Type type in the GameObject or any of its children.

(Inherited from Component.)
Public methodGetComponentsInChildren``1 (Inherited from Component.)
Public methodGetComponentsInChildren``1(Boolean) (Inherited from Component.)
Public methodGetComponentsInChildren``1(ListUMP) (Inherited from Component.)
Public methodGetComponentsInChildren``1(Boolean, ListUMP) (Inherited from Component.)
Public methodGetComponentsInParent(Type) (Inherited from Component.)
Public methodGetComponentsInParent(Type, Boolean)

Returns all components of Type type in the GameObject or any of its parents.

(Inherited from Component.)
Public methodGetComponentsInParent``1 (Inherited from Component.)
Public methodGetComponentsInParent``1(Boolean) (Inherited from Component.)
Public methodGetComponentsInParent``1(Boolean, ListUMP) (Inherited from Component.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetInstanceID

Returns the instance id of the object.

(Inherited from Object.)
Public methodGetType
Gets the type of the current instance.
(Inherited from Object.)
Public methodInvoke

Invokes the method methodName in time seconds.

(Inherited from MonoBehaviour.)
Public methodInvokeRepeating

Invokes the method methodName in time seconds, then repeatedly every repeatRate seconds.

(Inherited from MonoBehaviour.)
Public methodIsInvoking

Is any invoke pending on this MonoBehaviour?

(Inherited from MonoBehaviour.)
Public methodIsInvoking(String)

Is any invoke on methodName pending?

(Inherited from MonoBehaviour.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodOnDisable
Called when the MonoBehaviour is disabled.
Protected methodOnEnable
Called when the MonoBehaviour is enabled.
Public methodOnEvent(Int32, IResourceEventTSource, TArgs)
Called when an event is invoked.
Public methodOnEvent(Int32, IResourcePreChangeEventTSource, TArgs)
Called when an event is invoked.
Public methodRemove(Single, Boolean)
Removes the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRemove(Single, TSource, Boolean)
Removes the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRemove(Single, TSource, TArgs, Boolean)
Removes the specified amount of resource to the pool.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(Boolean)
Fully restores the pool, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(Single, Boolean)
Restores the pool to the specified amount, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(TSource, Boolean)
Fully restores the pool, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(Single, TSource, Boolean)
Restores the pool to the specified amount, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(TSource, TArgs, Boolean)
Fully restores the pool, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodRenew(Single, TSource, TArgs, Boolean)
Restores the pool to the specified amount, regardless of EmptyTillRenewed.
(Inherited from ResourcePoolTSource, TArgs.)
Public methodSendMessage(String)

Calls the method named methodName on every MonoBehaviour in this game object.

(Inherited from Component.)
Public methodSendMessage(String, Object)

Calls the method named methodName on every MonoBehaviour in this game object.

(Inherited from Component.)
Public methodSendMessage(String, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object.

(Inherited from Component.)
Public methodSendMessage(String, Object, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object.

(Inherited from Component.)
Public methodSendMessageUpwards(String)

Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.

(Inherited from Component.)
Public methodSendMessageUpwards(String, Object)

Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.

(Inherited from Component.)
Public methodSendMessageUpwards(String, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.

(Inherited from Component.)
Public methodSendMessageUpwards(String, Object, SendMessageOptions)

Calls the method named methodName on every MonoBehaviour in this game object and on every ancestor of the behaviour.

(Inherited from Component.)
Public methodStartCoroutine(IEnumerator)

Starts a coroutine.

(Inherited from MonoBehaviour.)
Public methodStartCoroutine(String)

Starts a coroutine named methodName.

(Inherited from MonoBehaviour.)
Public methodStartCoroutine(String, Object)

Starts a coroutine named methodName.

(Inherited from MonoBehaviour.)
Public methodStartCoroutine_Auto Obsolete. (Inherited from MonoBehaviour.)
Public methodStopAllCoroutines

Stops all coroutines running on this behaviour.

(Inherited from MonoBehaviour.)
Public methodStopCoroutine(String)

Stops the first coroutine named methodName, or the coroutine stored in routine running on this behaviour.

(Inherited from MonoBehaviour.)
Public methodStopCoroutine(IEnumerator)

Stops the first coroutine named methodName, or the coroutine stored in routine running on this behaviour.

(Inherited from MonoBehaviour.)
Public methodStopCoroutine(Coroutine) (Inherited from MonoBehaviour.)
Public methodToString

Returns the name of the game object.

(Inherited from Object.)
Top
Fields
Extension Methods
  NameDescription
Public Extension MethodStartBetterCoroutine(IEnumerator, UpdateLoop)Overloaded.
Starts a new coroutine.
(Defined by BetterCoroutinesExtensions.)
Public Extension MethodStartBetterCoroutine(IEnumerator, Int32)Overloaded.
Starts a new coroutine.
(Defined by BetterCoroutinesExtensions.)
Public Extension MethodStartBetterCoroutineLinked(IEnumerator, UpdateLoop)Overloaded.
Starts a new coroutine with its lifetime linked to this component. The coroutine will be stopped when the linked component is disabled or destroyed.
(Defined by BetterCoroutinesExtensions.)
Public Extension MethodStartBetterCoroutineLinked(IEnumerator, Int32)Overloaded.
Starts a new coroutine with its lifetime linked to this component. The coroutine will be stopped when the linked component is disabled or destroyed.
(Defined by BetterCoroutinesExtensions.)
Public Extension MethodStopBetterCoroutine
Stops a running coroutine prematurely. This will stop any child coroutines as well.
(Defined by BetterCoroutinesExtensions.)
Top
See Also