Ejemplo n.º 1
0
        public void EditorFindDungeonPieces()
        {
            Modules.Clear();
            Transitions.Clear();

            int moduleNumber = 0;

            foreach (Transform module in ModuleParent)
            {
                DungeonModule dungeonModule = module.gameObject.GetOrAdd <DungeonModule> ();
                dungeonModule.ModuleNumber   = moduleNumber;
                dungeonModule.ParentDungeon  = this;
                dungeonModule.OcclusionGroup = dungeonModule.gameObject.GetOrAdd <CullingGroup_Manual> ();
                dungeonModule.Initialize();
                Modules.Add(dungeonModule);
                moduleNumber++;
            }

            int transitionNumber = 0;

            foreach (Transform transition in TransitionParent)
            {
                DungeonTransition dungeonTransition = transition.gameObject.GetOrAdd <DungeonTransition> ();
                dungeonTransition.ParentDungeon    = this;
                dungeonTransition.TransitionNumber = transitionNumber;
                dungeonTransition.OcclusionGroup   = dungeonTransition.gameObject.GetOrAdd <CullingGroup_Manual> ();
                dungeonTransition.Initialize();
                dungeonTransition.FindTriggers();
                Transitions.Add(dungeonTransition);
                transitionNumber++;
            }
        }
Ejemplo n.º 2
0
        protected DungeonTransition CreateDungeonTransition(int transitionNum)
        {
            //first create the object
            Transform         transitionTransform = TransitionParent.gameObject.FindOrCreateChild(TransitionName(name, transitionNum));
            DungeonTransition dungeonTransition   = transitionTransform.gameObject.AddComponent <DungeonTransition> ();

            dungeonTransition.ParentDungeon    = this;
            dungeonTransition.TransitionNumber = transitionNum;
            dungeonTransition.OcclusionGroup   = dungeonTransition.gameObject.AddComponent <CullingGroup_Manual> ();
            dungeonTransition.Initialize();
            Transitions.Add(dungeonTransition);
            return(dungeonTransition);
        }
Ejemplo n.º 3
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));
        }
Ejemplo n.º 4
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);
            }
        }