C# Class Duality.Resources.PrefabLink

Represents a GameObject">GameObjects connection to the
Mostrar archivo Open project: BraveSirAndrew/duality Class Usage Examples

Public Methods

Method Description
AffectsObject ( Component cmp ) : bool

Returns whether a specific object is affected by this PrefabLink.

AffectsObject ( GameObject obj ) : bool

Returns whether a specific object is affected by this PrefabLink.

Apply ( ) : void

Applies both Prefab and change list to this PrefabLinks GameObject.

ApplyAllLinks ( IEnumerable objEnum, Predicate predicate = null ) : List

Applies all PrefabLinks in a set of GameObjects.

ApplyChanges ( ) : void

Applies this PrefabLinks change list to its GameObject. This will restore all deliberate modifications (made in the editor) of the GameObjects Properties after linking it to the Prefab.

ApplyPrefab ( ) : void

Applies the Prefab to this PrefabLinks GameObject. This will overwrite all of its existing data and establish the state as defined in the Prefab.

ClearChanges ( ) : void

Clears the change list.

ClearChanges ( GameObject targetObj, Type cmpType, PropertyInfo prop ) : void

Clears the change list for certain objects

Clone ( ) : PrefabLink

Clones the PrefabLink.

Clone ( GameObject newObj ) : PrefabLink

Clones the PrefabLink, but targets a different GameObject.

Clone ( GameObject newObj, ContentRef newPrefab ) : PrefabLink

Clones the PrefabLink, but targets a different GameObject and Prefab.

HasChange ( object target, PropertyInfo prop ) : bool

Returns whether there is a specific change list entry.

PopChange ( object target, PropertyInfo prop ) : void

Removes an existing change list entry.

PrefabLink ( GameObject obj, ContentRef prefab ) : System

Creates a new PrefabLink, connecting a GameObject to a Prefab.

PushChange ( object target, PropertyInfo prop ) : void

Creates a new change list entry.

PushChange ( object target, PropertyInfo prop, object value ) : void

Creates a new change list entry.

RelocateChanges ( PrefabLink other ) : void

Relocates the internal change list from this PrefabLink to a different, hierarchially lower PrefabLink.

In general, each PrefabLink is responsible for all hierarchially lower GameObjects. If one of them has a PrefabLink on its own, then the higher PrefabLinks responsibility ends there.

Change relocation is done when linking an existing GameObject to a Prefab although it is already affected by a hierarchially higher PrefabLink. In order to prevent both PrefabLinks to interfere with each other, all higher PrefabLink change list entries referring to that GameObject are relocated to the new, lower PrefabLink that is specifically targetting it.

This way, the above responsibility guideline remains applicable.

UpdateChanges ( ) : void

Updates all existing change list entries by the GameObjects current Property values.

Private Methods

Method Description
Apply ( bool deep ) : void
ClearEmptyChanges ( ) : void
ICloneExplicit ( object targetObj, CloneProvider provider ) : void
PopChange ( IEnumerable indexPath, PropertyInfo prop, Type componentType = null ) : void
PrefabLink ( ) : System

Method Details

AffectsObject() public method

Returns whether a specific object is affected by this PrefabLink.
public AffectsObject ( Component cmp ) : bool
cmp Component
return bool

AffectsObject() public method

Returns whether a specific object is affected by this PrefabLink.
public AffectsObject ( GameObject obj ) : bool
obj GameObject
return bool

Apply() public method

Applies both Prefab and change list to this PrefabLinks GameObject.
public Apply ( ) : void
return void

ApplyAllLinks() public static method

Applies all PrefabLinks in a set of GameObjects.
public static ApplyAllLinks ( IEnumerable objEnum, Predicate predicate = null ) : List
objEnum IEnumerable An enumeration of all GameObjects containing PrefabLinks that are to apply.
predicate Predicate An optional predicate. If set, only PrefabLinks meeting its requirements are applied.
return List

ApplyChanges() public method

Applies this PrefabLinks change list to its GameObject. This will restore all deliberate modifications (made in the editor) of the GameObjects Properties after linking it to the Prefab.
public ApplyChanges ( ) : void
return void

ApplyPrefab() public method

Applies the Prefab to this PrefabLinks GameObject. This will overwrite all of its existing data and establish the state as defined in the Prefab.
public ApplyPrefab ( ) : void
return void

ClearChanges() public method

Clears the change list.
public ClearChanges ( ) : void
return void

ClearChanges() public method

Clears the change list for certain objects
public ClearChanges ( GameObject targetObj, Type cmpType, PropertyInfo prop ) : void
targetObj GameObject
cmpType System.Type
prop System.Reflection.PropertyInfo
return void

Clone() public method

Clones the PrefabLink.
public Clone ( ) : PrefabLink
return PrefabLink

Clone() public method

Clones the PrefabLink, but targets a different GameObject.
public Clone ( GameObject newObj ) : PrefabLink
newObj GameObject The GameObject which the clone is connected to.
return PrefabLink

Clone() public method

Clones the PrefabLink, but targets a different GameObject and Prefab.
public Clone ( GameObject newObj, ContentRef newPrefab ) : PrefabLink
newObj GameObject The GameObject which the clone is connected to.
newPrefab ContentRef The Prefab which the clone will connect its GameObject to.
return PrefabLink

HasChange() public method

Returns whether there is a specific change list entry.
public HasChange ( object target, PropertyInfo prop ) : bool
target object The target object in which the change has been made. Must be a GameObject or Component.
prop System.Reflection.PropertyInfo The target objects Property that has been changed.
return bool

PopChange() public method

Removes an existing change list entry.
public PopChange ( object target, PropertyInfo prop ) : void
target object The target object in which the change has been made. Must be a GameObject or Component.
prop System.Reflection.PropertyInfo The target objects Property that has been changed.
return void

PrefabLink() public method

Creates a new PrefabLink, connecting a GameObject to a Prefab.
public PrefabLink ( GameObject obj, ContentRef prefab ) : System
obj GameObject The GameObject to link.
prefab ContentRef The Prefab to connect the GameObject with.
return System

PushChange() public method

Creates a new change list entry.
public PushChange ( object target, PropertyInfo prop ) : void
target object The target object in which the change has been made. Must be a GameObject or Component.
prop System.Reflection.PropertyInfo The target objects Property that has been changed.
return void

PushChange() public method

Creates a new change list entry.
public PushChange ( object target, PropertyInfo prop, object value ) : void
target object The target object in which the change has been made. Must be a GameObject or Component.
prop System.Reflection.PropertyInfo The target objects Property that has been changed.
value object The value to which the specified Property has been changed to.
return void

RelocateChanges() public method

Relocates the internal change list from this PrefabLink to a different, hierarchially lower PrefabLink.

In general, each PrefabLink is responsible for all hierarchially lower GameObjects. If one of them has a PrefabLink on its own, then the higher PrefabLinks responsibility ends there.

Change relocation is done when linking an existing GameObject to a Prefab although it is already affected by a hierarchially higher PrefabLink. In order to prevent both PrefabLinks to interfere with each other, all higher PrefabLink change list entries referring to that GameObject are relocated to the new, lower PrefabLink that is specifically targetting it.

This way, the above responsibility guideline remains applicable.

public RelocateChanges ( PrefabLink other ) : void
other PrefabLink /// The PrefabLink to which to relocate changes. It needs to be hierarchially lower than /// this one for the relocation to succeed. ///
return void

UpdateChanges() public method

Updates all existing change list entries by the GameObjects current Property values.
public UpdateChanges ( ) : void
return void