Show / Hide Table of Contents

Class GameObjectHelper

Static helper methods to instantiate common types of Daggerfall gameobjects.

Inheritance
Object
GameObjectHelper
Namespace: DaggerfallWorkshop.Utility
Assembly: Assembly-CSharp.dll
Syntax
public static class GameObjectHelper

Properties

| Improve this Doc View Source

EnemyDict

Declaration
public static Dictionary<int, MobileEnemy> EnemyDict { get; }
Property Value
Type Description
Dictionary<Int32, MobileEnemy>

Methods

| Improve this Doc View Source

AddAnimalAudioSource(GameObject, Int32)

Declaration
public static void AddAnimalAudioSource(GameObject go, int record)
Parameters
Type Name Description
GameObject go
Int32 record
| Improve this Doc View Source

AddQuestResourceObjects(SiteTypes, Transform, Int32, Boolean, Boolean, Boolean)

Finds SiteLinks matching this interior and walks Place markers to inject quest resources. Some of this handling will be split and relocated for other builders. Just working through the steps in buildings interiors for now. This will be moved to a different setup class later.

Declaration
public static void AddQuestResourceObjects(SiteTypes siteType, Transform parent, int buildingKey = 0, bool enableNPCs = true, bool enableFoes = true, bool enableItems = true)
Parameters
Type Name Description
SiteTypes siteType
Transform parent
Int32 buildingKey
Boolean enableNPCs
Boolean enableFoes
Boolean enableItems
| Improve this Doc View Source

AlignBillboardToGround(GameObject, Vector2, Single)

Declaration
public static void AlignBillboardToGround(GameObject go, Vector2 size, float distance = 2F)
Parameters
Type Name Description
GameObject go
Vector2 size
Single distance
| Improve this Doc View Source

AlignControllerToGround(CharacterController, Single)

Declaration
public static void AlignControllerToGround(CharacterController controller, float distance = 3F)
Parameters
Type Name Description
CharacterController controller
Single distance
| Improve this Doc View Source

AssignAnimatedMaterialComponent(CachedMaterial[], GameObject)

Declaration
public static void AssignAnimatedMaterialComponent(CachedMaterial[] cachedMaterials, GameObject go)
Parameters
Type Name Description
CachedMaterial[] cachedMaterials
GameObject go
| Improve this Doc View Source

ChangeDaggerfallMeshGameObject(DaggerfallMesh, UInt32)

Declaration
public static void ChangeDaggerfallMeshGameObject(DaggerfallMesh dfMesh, uint newModelID)
Parameters
Type Name Description
DaggerfallMesh dfMesh
UInt32 newModelID
| Improve this Doc View Source

CreateBillboardBatchGameObject(Int32, Transform)

Create a billboard batch.

Declaration
public static DaggerfallBillboardBatch CreateBillboardBatchGameObject(int archive, Transform parent = null)
Parameters
Type Name Description
Int32 archive

Archive this batch is to use.

Transform parent

Parent transform.

Returns
Type Description
DaggerfallBillboardBatch

Billboard batch GameObject.

| Improve this Doc View Source

CreateBillboardBatchGameObject(Material, Transform)

Create a billboard batch with custom material/

Declaration
public static DaggerfallBillboardBatch CreateBillboardBatchGameObject(Material material, Transform parent = null)
Parameters
Type Name Description
Material material

Custom atlas material.

Transform parent

Parent transform.

Returns
Type Description
DaggerfallBillboardBatch

Billboard batch GameObject.

| Improve this Doc View Source

CreateCombinedMeshGameObject(ModelCombiner, String, Transform, Boolean)

Declaration
public static GameObject CreateCombinedMeshGameObject(ModelCombiner combiner, string meshName, Transform parent, bool makeStatic = false)
Parameters
Type Name Description
ModelCombiner combiner
String meshName
Transform parent
Boolean makeStatic
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateDaggerfallBillboardGameObject(Int32, Int32, Transform)

Declaration
public static GameObject CreateDaggerfallBillboardGameObject(int archive, int record, Transform parent)
Parameters
Type Name Description
Int32 archive
Int32 record
Transform parent
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateDaggerfallDungeonGameObject(DFLocation, Transform, out GameObject)

Declaration
public static DaggerfallDungeon CreateDaggerfallDungeonGameObject(DFLocation location, Transform parent, out GameObject go)
Parameters
Type Name Description
DFLocation location
Transform parent
GameObject go
Returns
Type Description
DaggerfallDungeon
| Improve this Doc View Source

CreateDaggerfallDungeonGameObject(String, Transform, Boolean)

Declaration
public static GameObject CreateDaggerfallDungeonGameObject(string multiName, Transform parent, bool importEnemies = true)
Parameters
Type Name Description
String multiName
Transform parent
Boolean importEnemies
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateDaggerfallLocationGameObject(String, Transform)

Declaration
public static GameObject CreateDaggerfallLocationGameObject(string multiName, Transform parent)
Parameters
Type Name Description
String multiName
Transform parent
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateDaggerfallMeshGameObject(UInt32, Transform, Boolean, GameObject, Boolean, Boolean)

Adds a single DaggerfallMesh game object to scene.

Declaration
public static GameObject CreateDaggerfallMeshGameObject(uint modelID, Transform parent, bool makeStatic = false, GameObject useExistingObject = null, bool ignoreCollider = false, bool convexCollider = false)
Parameters
Type Name Description
UInt32 modelID

ModelID of mesh to add.

Transform parent

Optional parent of this object.

Boolean makeStatic

Flag to set object static flag.

GameObject useExistingObject

Add mesh to existing object rather than create new.

Boolean ignoreCollider

Force disable collider.

Boolean convexCollider

Make collider convex.

Returns
Type Description
GameObject

GameObject.

| Improve this Doc View Source

CreateDaggerfallTerrainGameObject(Transform)

Declaration
public static GameObject CreateDaggerfallTerrainGameObject(Transform parent)
Parameters
Type Name Description
Transform parent
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateDroppedLootContainer(GameObject, UInt64, Int32, Int32)

Creates a loot container for items dropped by the player.

Declaration
public static DaggerfallLoot CreateDroppedLootContainer(GameObject player, ulong loadID, int iconArchive = 216, int iconRecord = -1)
Parameters
Type Name Description
GameObject player

Player object, must have PlayerEnterExit and PlayerMotor attached.

UInt64 loadID

Unique LoadID for save system.

Int32 iconArchive
Int32 iconRecord
Returns
Type Description
DaggerfallLoot

DaggerfallLoot.

| Improve this Doc View Source

CreateEnemy(String, MobileTypes, Vector3, MobileGender, Transform, MobileReactions)

Create an enemy in the world and perform common setup tasks.

Declaration
public static GameObject CreateEnemy(string name, MobileTypes mobileType, Vector3 localPosition, MobileGender mobileGender = MobileGender.Unspecified, Transform parent = null, MobileReactions mobileReaction = MobileReactions.Hostile)
Parameters
Type Name Description
String name
MobileTypes mobileType
Vector3 localPosition
MobileGender mobileGender
Transform parent
MobileReactions mobileReaction
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateFoeGameObjects(Vector3, MobileTypes, Int32, MobileReactions, Foe, Boolean)

Creates enemy GameObjects based on spawn count (minimum of 1, maximum of 8). Only use this when live enemy is to be first added to scene. Do not use when linking to site or deserializing. GameObjects created will be disabled, at position specified, parentless, and have a new UID for LoadID. Caller must otherwise complete GameObject setup to suit their needs before enabling.

Declaration
public static GameObject[] CreateFoeGameObjects(Vector3 position, MobileTypes foeType, int spawnCount = 1, MobileReactions reaction = MobileReactions.Hostile, Foe foeResource = null, bool alliedToPlayer = false)
Parameters
Type Name Description
Vector3 position
MobileTypes foeType
Int32 spawnCount
MobileReactions reaction

Foe is hostile by default but can optionally set to passive.

Foe foeResource
Boolean alliedToPlayer
Returns
Type Description
GameObject[]

GameObject[] array of 1-N foes. Array can be null or empty if create fails.

| Improve this Doc View Source

CreateFoeSpawner(Boolean, MobileTypes, Int32, Single, Single, Transform, Boolean)

Create a new foe spawner. The spawner will self-destroy once it has emitted foes into world around player.

Declaration
public static GameObject CreateFoeSpawner(bool lineOfSightCheck = true, MobileTypes foeType = MobileTypes.None, int spawnCount = 0, float minDistance = 4F, float maxDistance = 20F, Transform parent = null, bool alliedToPlayer = false)
Parameters
Type Name Description
Boolean lineOfSightCheck

Should spawner try to place outside of player's field of view.

MobileTypes foeType

Type of foe to spawn.

Int32 spawnCount

Number of duplicate foes to spawn.

Single minDistance

Minimum distance from player.

Single maxDistance

Maximum distance from player.

Transform parent

Parent GameObject. If none specified the most suitable parent will be selected automatically.

Boolean alliedToPlayer
Returns
Type Description
GameObject

FoeSpawner GameObject.

| Improve this Doc View Source

CreateLootableCorpseMarker(GameObject, GameObject, EnemyEntity, Int32, UInt64)

Creates a loot container for enemies slain by the player.

Declaration
public static DaggerfallLoot CreateLootableCorpseMarker(GameObject player, GameObject enemy, EnemyEntity enemyEntity, int corpseTexture, ulong loadID)
Parameters
Type Name Description
GameObject player

Player object, must have PlayerEnterExit attached.

GameObject enemy

Enemy object, must have EnemyMotor attached.

EnemyEntity enemyEntity
Int32 corpseTexture

Packed corpse texture index from entity summary.

UInt64 loadID

Unique LoadID for save system.

Returns
Type Description
DaggerfallLoot

DaggerfallLoot.

| Improve this Doc View Source

CreateLootContainer(LootContainerTypes, InventoryContainerImages, Vector3, Transform, Int32, Int32, UInt64, EnemyEntity, Boolean)

Creates a generic loot container.

Declaration
public static DaggerfallLoot CreateLootContainer(LootContainerTypes containerType, InventoryContainerImages containerImage, Vector3 position, Transform parent, int textureArchive, int textureRecord, ulong loadID = 0UL, EnemyEntity enemyEntity = null, bool adjustPosition = true)
Parameters
Type Name Description
LootContainerTypes containerType

Type of container.

InventoryContainerImages containerImage

Icon to display in loot UI.

Vector3 position

Position to spawn container.

Transform parent

Parent GameObject.

Int32 textureArchive

Texture archive for billboard containers.

Int32 textureRecord

Texture record for billboard containers.

UInt64 loadID

Unique LoadID for save system.

EnemyEntity enemyEntity
Boolean adjustPosition
Returns
Type Description
DaggerfallLoot

DaggerfallLoot.

| Improve this Doc View Source

CreateRDBBlockGameObject(String, Int32[], Boolean, DFRegion.DungeonTypes, Single, Int32, Int32, DaggerfallRDBBlock, Boolean)

Layout a complete RDB block game object.

Declaration
public static GameObject CreateRDBBlockGameObject(string blockName, int[] textureTable = null, bool allowExitDoors = true, DFRegion.DungeonTypes dungeonType = DFRegion.DungeonTypes.HumanStronghold, float monsterPower = 0.5F, int monsterVariance = 4, int seed = 0, DaggerfallRDBBlock cloneFrom = null, bool importEnemies = true)
Parameters
Type Name Description
String blockName

Name of block to create.

Int32[] textureTable

Optional texture table for dungeon.

Boolean allowExitDoors

Add exit doors to block (for start blocks).

DFRegion.DungeonTypes dungeonType

Dungeon type for random encounters.

Single monsterPower
Int32 monsterVariance
Int32 seed

Seed for random encounters.

DaggerfallRDBBlock cloneFrom

Clone and build on a prefab object template.

Boolean importEnemies

Import enemies from game data.

Returns
Type Description
GameObject
| Improve this Doc View Source

CreateRMBBlockGameObject(DFBlock, Int32, Int32, Int32, Int32, Boolean, DaggerfallRMBBlock, DaggerfallBillboardBatch, DaggerfallBillboardBatch, DaggerfallBillboardBatch, TextureAtlasBuilder, DaggerfallBillboardBatch, ClimateNatureSets, ClimateSeason)

Layout RMB block game object from DFBlock data.

Declaration
public static GameObject CreateRMBBlockGameObject(DFBlock blockData, int layoutX, int layoutY, int mapId, int locationIndex, bool addGroundPlane = true, DaggerfallRMBBlock cloneFrom = null, DaggerfallBillboardBatch natureBillboardBatch = null, DaggerfallBillboardBatch lightsBillboardBatch = null, DaggerfallBillboardBatch animalsBillboardBatch = null, TextureAtlasBuilder miscBillboardAtlas = null, DaggerfallBillboardBatch miscBillboardBatch = null, ClimateNatureSets climateNature = ClimateNatureSets.TemperateWoodland, ClimateSeason climateSeason = ClimateSeason.Summer)
Parameters
Type Name Description
DFBlock blockData
Int32 layoutX
Int32 layoutY
Int32 mapId
Int32 locationIndex
Boolean addGroundPlane
DaggerfallRMBBlock cloneFrom
DaggerfallBillboardBatch natureBillboardBatch
DaggerfallBillboardBatch lightsBillboardBatch
DaggerfallBillboardBatch animalsBillboardBatch
TextureAtlasBuilder miscBillboardAtlas
DaggerfallBillboardBatch miscBillboardBatch
ClimateNatureSets climateNature
ClimateSeason climateSeason
Returns
Type Description
GameObject
| Improve this Doc View Source

CreateRMBBlockGameObject(String, Int32, Int32, Int32, Int32, Boolean, DaggerfallRMBBlock, DaggerfallBillboardBatch, DaggerfallBillboardBatch, DaggerfallBillboardBatch, TextureAtlasBuilder, DaggerfallBillboardBatch, ClimateNatureSets, ClimateSeason)

Layout RMB block gamne object from name only. This will be missing information like building data and should only be used standalone.

Declaration
public static GameObject CreateRMBBlockGameObject(string blockName, int layoutX, int layoutY, int mapId, int locationIndex, bool addGroundPlane = true, DaggerfallRMBBlock cloneFrom = null, DaggerfallBillboardBatch natureBillboardBatch = null, DaggerfallBillboardBatch lightsBillboardBatch = null, DaggerfallBillboardBatch animalsBillboardBatch = null, TextureAtlasBuilder miscBillboardAtlas = null, DaggerfallBillboardBatch miscBillboardBatch = null, ClimateNatureSets climateNature = ClimateNatureSets.TemperateWoodland, ClimateSeason climateSeason = ClimateSeason.Summer)
Parameters
Type Name Description
String blockName
Int32 layoutX
Int32 layoutY
Int32 mapId
Int32 locationIndex
Boolean addGroundPlane
DaggerfallRMBBlock cloneFrom
DaggerfallBillboardBatch natureBillboardBatch
DaggerfallBillboardBatch lightsBillboardBatch
DaggerfallBillboardBatch animalsBillboardBatch
TextureAtlasBuilder miscBillboardAtlas
DaggerfallBillboardBatch miscBillboardBatch
ClimateNatureSets climateNature
ClimateSeason climateSeason
Returns
Type Description
GameObject
| Improve this Doc View Source

FindMultiNameLocation(String, out DFLocation)

Declaration
public static bool FindMultiNameLocation(string multiName, out DFLocation locationOut)
Parameters
Type Name Description
String multiName
DFLocation locationOut
Returns
Type Description
Boolean
| Improve this Doc View Source

GetBestParent()

Gets best parent for an object at spawn time. Objects should always be placed to some child object in world rather than directly into root of scene.

Declaration
public static Transform GetBestParent()
Returns
Type Description
Transform

Best parent transform, or null as fallback.

| Improve this Doc View Source

GetGoFlatName(Int32, Int32)

Declaration
public static string GetGoFlatName(int textureArchive, int textureRecord)
Parameters
Type Name Description
Int32 textureArchive
Int32 textureRecord
Returns
Type Description
String
| Improve this Doc View Source

GetGoModelName(UInt32)

Declaration
public static string GetGoModelName(uint modelID)
Parameters
Type Name Description
UInt32 modelID
Returns
Type Description
String
| Improve this Doc View Source

GetMaterialArray(CachedMaterial[])

Declaration
public static Material[] GetMaterialArray(CachedMaterial[] cachedMaterials)
Parameters
Type Name Description
CachedMaterial[] cachedMaterials
Returns
Type Description
Material[]
| Improve this Doc View Source

GetSpawnParentTransform()

Gets the most appropriate parent transform based on player context for a freely spawned object. Buildings, exteriors, and dungeons all have different parents.

Declaration
public static Transform GetSpawnParentTransform()
Returns
Type Description
Transform

Parent transform.

| Improve this Doc View Source

GetStaticDoors(ref ModelData, Int32, Int32, Matrix4x4)

Gets static door array from door information stored in model data.

Declaration
public static StaticDoor[] GetStaticDoors(ref ModelData modelData, int blockIndex, int recordIndex, Matrix4x4 buildingMatrix)
Parameters
Type Name Description
ModelData modelData

Model data for doors.

Int32 blockIndex

Block index for RMB doors.

Int32 recordIndex

Record index of interior.

Matrix4x4 buildingMatrix

Individual building matrix.

Returns
Type Description
StaticDoor[]

Array of doors in this model data.

| Improve this Doc View Source

InstantiatePrefab(GameObject, String, Transform, Vector3)

Instantiate a GameObject from prefab.

Declaration
public static GameObject InstantiatePrefab(GameObject prefab, string name, Transform parent, Vector3 position)
Parameters
Type Name Description
GameObject prefab

The source GameObject prefab to clone.

String name

Optional name to set. Use string.Empty for default.

Transform parent

Optional parent to set. Use null for default.

Vector3 position

Optional position to set. Use Vector3.zero for default.

Returns
Type Description
GameObject

GameObject.

| Improve this Doc View Source

IsStaticGeometry(GameObject)

Declaration
public static bool IsStaticGeometry(GameObject go)
Parameters
Type Name Description
GameObject go
Returns
Type Description
Boolean
| Improve this Doc View Source

QuaternionFromMatrix(Matrix4x4)

Declaration
public static Quaternion QuaternionFromMatrix(Matrix4x4 m)
Parameters
Type Name Description
Matrix4x4 m
Returns
Type Description
Quaternion
| Improve this Doc View Source

RemoveLootContainer(DaggerfallLoot)

Destroys/Disables a loot container. Ignores unsupported or persistent container types. Custom drop containers will be destroyed from world. Fixed containers will be disabled so their empty state continues to be serialized.

Declaration
public static void RemoveLootContainer(DaggerfallLoot loot)
Parameters
Type Name Description
DaggerfallLoot loot

DaggerfallLoot.

| Improve this Doc View Source

TagStaticGeometry(GameObject)

Declaration
public static void TagStaticGeometry(GameObject go)
Parameters
Type Name Description
GameObject go
  • Improve this Doc
  • View Source
In This Article
  • Properties
    • EnemyDict
  • Methods
    • AddAnimalAudioSource(GameObject, Int32)
    • AddQuestResourceObjects(SiteTypes, Transform, Int32, Boolean, Boolean, Boolean)
    • AlignBillboardToGround(GameObject, Vector2, Single)
    • AlignControllerToGround(CharacterController, Single)
    • AssignAnimatedMaterialComponent(CachedMaterial[], GameObject)
    • ChangeDaggerfallMeshGameObject(DaggerfallMesh, UInt32)
    • CreateBillboardBatchGameObject(Int32, Transform)
    • CreateBillboardBatchGameObject(Material, Transform)
    • CreateCombinedMeshGameObject(ModelCombiner, String, Transform, Boolean)
    • CreateDaggerfallBillboardGameObject(Int32, Int32, Transform)
    • CreateDaggerfallDungeonGameObject(DFLocation, Transform, out GameObject)
    • CreateDaggerfallDungeonGameObject(String, Transform, Boolean)
    • CreateDaggerfallLocationGameObject(String, Transform)
    • CreateDaggerfallMeshGameObject(UInt32, Transform, Boolean, GameObject, Boolean, Boolean)
    • CreateDaggerfallTerrainGameObject(Transform)
    • CreateDroppedLootContainer(GameObject, UInt64, Int32, Int32)
    • CreateEnemy(String, MobileTypes, Vector3, MobileGender, Transform, MobileReactions)
    • CreateFoeGameObjects(Vector3, MobileTypes, Int32, MobileReactions, Foe, Boolean)
    • CreateFoeSpawner(Boolean, MobileTypes, Int32, Single, Single, Transform, Boolean)
    • CreateLootableCorpseMarker(GameObject, GameObject, EnemyEntity, Int32, UInt64)
    • CreateLootContainer(LootContainerTypes, InventoryContainerImages, Vector3, Transform, Int32, Int32, UInt64, EnemyEntity, Boolean)
    • CreateRDBBlockGameObject(String, Int32[], Boolean, DFRegion.DungeonTypes, Single, Int32, Int32, DaggerfallRDBBlock, Boolean)
    • CreateRMBBlockGameObject(DFBlock, Int32, Int32, Int32, Int32, Boolean, DaggerfallRMBBlock, DaggerfallBillboardBatch, DaggerfallBillboardBatch, DaggerfallBillboardBatch, TextureAtlasBuilder, DaggerfallBillboardBatch, ClimateNatureSets, ClimateSeason)
    • CreateRMBBlockGameObject(String, Int32, Int32, Int32, Int32, Boolean, DaggerfallRMBBlock, DaggerfallBillboardBatch, DaggerfallBillboardBatch, DaggerfallBillboardBatch, TextureAtlasBuilder, DaggerfallBillboardBatch, ClimateNatureSets, ClimateSeason)
    • FindMultiNameLocation(String, out DFLocation)
    • GetBestParent()
    • GetGoFlatName(Int32, Int32)
    • GetGoModelName(UInt32)
    • GetMaterialArray(CachedMaterial[])
    • GetSpawnParentTransform()
    • GetStaticDoors(ref ModelData, Int32, Int32, Matrix4x4)
    • InstantiatePrefab(GameObject, String, Transform, Vector3)
    • IsStaticGeometry(GameObject)
    • QuaternionFromMatrix(Matrix4x4)
    • RemoveLootContainer(DaggerfallLoot)
    • TagStaticGeometry(GameObject)
Back to top Generated by DocFX