private static void AddEnemy( DFBlock.RdbObject obj, MobileTypes type, Transform parent = null, DFRegion.DungeonTypes dungeonType = DFRegion.DungeonTypes.HumanStronghold) { // Get default reaction MobileReactions reaction = MobileReactions.Hostile; if (obj.Resources.FlatResource.FlatData.Reaction == (int)DFBlock.EnemyReactionTypes.Passive) { reaction = MobileReactions.Passive; } // Just setup demo enemies at this time string name = string.Format("DaggerfallEnemy [{0}]", type.ToString()); Vector3 position = new Vector3(obj.XPos, -obj.YPos, obj.ZPos) * MeshReader.GlobalScale; GameObject go = GameObjectHelper.InstantiatePrefab(DaggerfallUnity.Instance.Option_EnemyPrefab.gameObject, name, parent, position); SetupDemoEnemy setupEnemy = go.GetComponent <SetupDemoEnemy>(); if (setupEnemy != null) { // Configure enemy setupEnemy.ApplyEnemySettings(type, reaction); // Align non-flying units with ground DaggerfallMobileUnit mobileUnit = setupEnemy.GetMobileBillboardChild(); if (mobileUnit.Summary.Enemy.Behaviour != MobileBehaviour.Flying) { GameObjectHelper.AlignControllerToGround(go.GetComponent <CharacterController>()); } } }