示例#1
0
        protected IEnumerator GenerateMinorItems()
        {
            StructureTemplateGroup structureGroup = Template.Exterior;

            yield return(StartCoroutine(StructureBuilder.AddGenericWorldItemsToStructure(structureGroup.GenericWItemsPieces, MinorGroup.transform, true, MinorGroup, null)));

            yield return(StartCoroutine(StructureBuilder.AddUniqueWorldItemsToStructure(structureGroup.UniqueWorlditems, MinorGroup.transform, true, MinorGroup, null)));

            yield break;
        }
示例#2
0
 public void BuildTransition(StructureTemplateGroup dungeonTransitionGroup, WIGroup dungeonGroup)
 {
     //then add the children
     for (int j = 0; j < dungeonTransitionGroup.StaticStructureLayers.Count; j++)
     {
         StructureTemplate.InstantiateStructureLayer(dungeonTransitionGroup.StaticStructureLayers [j], transform);
     }
     //create and find triggers
     StructureTemplate.InstantiateGenericDynamic(dungeonTransitionGroup.GenericDynamic, TriggerParent, dungeonGroup);
 }
示例#3
0
 public void CreateDungeonModules()
 {
     for (int i = 0; i < Template.Modules.InteriorVariants.Count; i++)
     {
         //first create the object
         StructureTemplateGroup dungeonModuleGroup = Template.Modules.InteriorVariants [i];
         DungeonModule          dungeonModule      = CreateDungeonModule(i);
         //move the group into position
         dungeonModule.transform.localPosition = dungeonModuleGroup.GroupOffset;
         dungeonModule.transform.localRotation = Quaternion.Euler(dungeonModuleGroup.GroupRotation);
         dungeonModule.Refresh();                 //move the group into the final position
         dungeonModule.BuildModule(dungeonModuleGroup, Template.HasLoadedModulesOnce);
     }
     Template.HasLoadedModulesOnce = true;
 }
示例#4
0
        public void BuildModule(StructureTemplateGroup dungeonModuleGroup, bool hasLoadedOnce)
        {
//			Transform normalFX = gameObject.FindOrCreateChild ("__FX");
//			Transform normalCol = gameObject.FindOrCreateChild ("__COLLIDERS");
//			Transform normalWIsGen = gameObject.FindOrCreateChild ("__WORLDITEMS_GENERIC");
//			Transform normalWindowsGen = gameObject.FindOrCreateChild ("__WINDOWS_GENERIC");
//			Transform normalDoorsGen = gameObject.FindOrCreateChild ("__DOORS_GENERIC");
//			Transform normalWIsUnique = gameObject.FindOrCreateChild ("__WORLDITEMS_UNIQUE");
//			Transform normalChrs = gameObject.FindOrCreateChild ("__ACTION_NODES");
//			Transform normalDyn = gameObject.FindOrCreateChild ("__DYNAMIC");
//			Transform normalStat = gameObject.FindOrCreateChild ("__STATIC");
//			Transform normalSub = gameObject.FindOrCreateChild ("__SUBSTRUCTURES");
//			Transform normalWindows = gameObject.FindOrCreateChild ("__WINDOWS");
//			Transform normalTriggers = gameObject.FindOrCreateChild ("__TRIGGERS");
//			//then add the children
//			for (int j = 0; j < dungeonModuleGroup.StaticStructureLayers.Count; j++) {
//				StructureTemplate.InstantiateStructureLayer (dungeonModuleGroup.StaticStructureLayers [j], normalStat);
//			}
//
//			if (!hasLoadedOnce) {
//				StartCoroutine (AddGenericWorldItemsToDungeon (dungeonModuleGroup.GenericWItems, normalWIsGen, false, ModuleGroup));
//				StartCoroutine (AddUniqueWorldItemsToDungeon (dungeonModuleGroup.UniqueWorlditems, normalWIsUnique, ModuleGroup));
//				ParentDungeon.ParentChunk.AddNodesToGroup (dungeonModuleGroup.ActionNodes, ModuleGroup, normalChrs);
//			} else {
//				Debug.Log ("Already loaded once, not spawning objects in " + name);
//			}
//
//			for (int i = 0; i < dungeonModuleGroup.ActionNodes.Count; i++) {
//				ActionNodeState acState = dungeonModuleGroup.ActionNodes [i];
//				if (acState.IsLoaded) {
//					Character character = null;
//					//TODO add our own region flags
//					Characters.SpawnCharacter (acState.actionNode, acState.OccupantName, ParentDungeon.ResidentFlags, ModuleGroup, out character);
//				}
//			}
//
//			WorldChunk chunk = ModuleGroup.GetParentChunk ();
//			foreach (KeyValuePair <string, KeyValuePair <string,string>> triggerStatePair in dungeonModuleGroup.Triggers) {
//				string triggerName = triggerStatePair.Key;
//				string triggerScriptName = triggerStatePair.Value.Key;
//				string triggerState = triggerStatePair.Value.Value;
//
//				GameObject newTriggerObject = normalTriggers.gameObject.CreateChild (triggerName).gameObject;
//				WorldTrigger worldTriggerScript	= newTriggerObject.AddComponent (triggerScriptName) as WorldTrigger;
//				worldTriggerScript.UpdateTriggerState (triggerState, chunk);
//			}
        }
示例#5
0
        public void EditorSaveDungeonToTemplate( )
        {
            if (!Manager.IsAwake <WorldItems> ())
            {
                Manager.WakeUp <WorldItems> ("Frontiers_WorldItems");
            }
            if (!Manager.IsAwake <Structures> ())
            {
                Manager.WakeUp <Structures> ("Frontiers_Structures");
            }
            if (!Manager.IsAwake <Mods> ())
            {
                Manager.WakeUp <Mods> ("__MODS");
            }
            Mods.Get.Editor.InitializeEditor(true);

            //make sure the dungeon is all set up
            CreateDungeonTransforms();
            EditorFindDungeonPieces();
            LinkOcclusionGroups();

            DungeonTemplate newTemplate = new DungeonTemplate();

            for (int i = 0; i < Modules.Count; i++)
            {
                DungeonModule          module = Modules [i];
                StructureTemplateGroup moduleInteriorGroup = new StructureTemplateGroup();
                moduleInteriorGroup.GroupOffset   = module.transform.localPosition;
                moduleInteriorGroup.GroupRotation = module.transform.localRotation.eulerAngles;
                module.EditorSaveModuleToTemplate(moduleInteriorGroup);
                newTemplate.Modules.InteriorVariants.Add(moduleInteriorGroup);
            }

            for (int i = 0; i < Transitions.Count; i++)
            {
                DungeonTransition      transition = Transitions [i];
                StructureTemplateGroup transitionInteriorGroup = new StructureTemplateGroup();
                transitionInteriorGroup.GroupOffset   = transition.transform.localPosition;
                transitionInteriorGroup.GroupRotation = transition.transform.localRotation.eulerAngles;
                StructureTemplate.AddStaticChildrenToStructureTemplate(transition.transform, transitionInteriorGroup.StaticStructureLayers);
                StructureTemplate.AddGenericDynamicToStructureTemplate(transition.TriggerParent, ref transitionInteriorGroup.GenericDynamic);
                newTemplate.Transitions.InteriorVariants.Add(transitionInteriorGroup);
            }

            Mods.Get.Editor.SaveMod <DungeonTemplate> (newTemplate, "Dungeon", GetTemplateName(gameObject.name));
        }
示例#6
0
        protected IEnumerator InstanceMeshes(
            StructureTemplateGroup structureGroup,
            string childName,
            List <Renderer> renderers,
            List <Renderer> lodRenderers,
            float lodRatio)
        {
            renderers.Clear();
            if (lodRenderers != null)
            {
                lodRenderers.Clear();
            }

            StructurePiece        = StructureBase.CreateChild(childName);
            StructurePiece.parent = null;
            if (Mode == BuilderMode.Minor)
            {
                //minor structures have to set their own offsets
                StructurePiece.position = MinorParent.Position;
                StructurePiece.rotation = Quaternion.Euler(MinorParent.Rotation);
            }
            else
            {
                StructurePiece.ResetLocal();
            }
            StructurePiece.gameObject.layer = Globals.LayerNumSolidTerrain;            //TODO this may be unnecessary
            for (int i = 0; i < structureGroup.StaticStructureLayers.Count; i++)
            {
                StructureTemplate.InstantiateStructureLayer(structureGroup.StaticStructureLayers [i], StructurePiece);
            }

            StructurePiece.parent = StructureBase.transform;
            if (Mode == BuilderMode.Minor)
            {
                StructurePiece.localPosition = MinorParent.Position;
                StructurePiece.localRotation = Quaternion.Euler(MinorParent.Rotation);
            }
            else
            {
                StructurePiece.ResetLocal();
            }
            yield break;
        }
示例#7
0
        public void EditorSaveModuleToTemplate(StructureTemplateGroup moduleInteriorGroup)
        {
            Transform normalFX         = gameObject.FindOrCreateChild("__FX");
            Transform normalCol        = gameObject.FindOrCreateChild("__COLLIDERS");
            Transform normalWIsGen     = gameObject.FindOrCreateChild("__WORLDITEMS_GENERIC");
            Transform normalWindowsGen = gameObject.FindOrCreateChild("__WINDOWS_GENERIC");
            Transform normalDoorsGen   = gameObject.FindOrCreateChild("__DOORS_GENERIC");
            Transform normalWIsUnique  = gameObject.FindOrCreateChild("__WORLDITEMS_UNIQUE");
            Transform normalChrs       = gameObject.FindOrCreateChild("__ACTION_NODES");
            Transform normalDyn        = gameObject.FindOrCreateChild("__DYNAMIC");
            Transform normalStat       = gameObject.FindOrCreateChild("__STATIC");
            Transform normalSub        = gameObject.FindOrCreateChild("__SUBSTRUCTURES");
            Transform normalWindows    = gameObject.FindOrCreateChild("__WINDOWS");
            Transform normalTriggers   = gameObject.FindOrCreateChild("__TRIGGERS");

            StructureTemplate.AddStaticChildrenToStructureTemplate(normalStat, moduleInteriorGroup.StaticStructureLayers);
            StructureTemplate.AddGenericWorldItemsToStructureTemplate(normalWIsGen, ref moduleInteriorGroup.GenericWItems);
            StructureTemplate.AddUniqueWorldItemsToStructureTemplate(normalWIsUnique, moduleInteriorGroup.UniqueWorlditems);
            StructureTemplate.AddActionNodesToTemplate(normalChrs, moduleInteriorGroup.ActionNodes);
            StructureTemplate.AddTriggersToStructureTemplate(normalTriggers, moduleInteriorGroup.Triggers);
        }
示例#8
0
        public void CreateDungeonTransitions()
        {
            if (Template == null)
            {
                Debug.Log("TEMPLATE WAS NULL");
                return;
            }

            for (int i = 0; i < Template.Transitions.InteriorVariants.Count; i++)
            {
                //first create the object
                StructureTemplateGroup dungeonTransitionGroup = Template.Transitions.InteriorVariants [i];
                DungeonTransition      dungeonTransition      = CreateDungeonTransition(i);
                dungeonTransition.BuildTransition(dungeonTransitionGroup, DungeonGroup);
                dungeonTransition.FindTriggers();
                //move the group into position
                dungeonTransition.OuterTrigger.OnEnter   += OnEnterDungeon;
                dungeonTransition.OuterTrigger.OnExit    += OnExitDungeon;
                dungeonTransition.InnerTrigger.OnExit    += OnExitTransition;
                dungeonTransition.InnerTrigger.OnEnter   += OnEnterTransition;
                dungeonTransition.transform.localPosition = dungeonTransitionGroup.GroupOffset;
                dungeonTransition.transform.localRotation = Quaternion.Euler(dungeonTransitionGroup.GroupRotation);
            }
        }