Example #1
0
        public override void OnEditorRefresh()
        {
            List <STransform> newHeadstonePoints = new List <STransform>();
            StructureBuilder  sb = null;

            foreach (Transform child in transform)
            {
                if (child.name == "Headstone")
                {
                    newHeadstonePoints.Add(child);
                }
                else if (child.gameObject.HasComponent <StructureBuilder>(out sb))
                {
                    State.GraveyardStructure.TemplateName = StructureBuilder.GetTemplateName(child.name);
                    State.GraveyardStructure.Position     = child.localPosition;
                    State.GraveyardStructure.Rotation     = child.localRotation.eulerAngles;
                }
            }
            if (newHeadstonePoints.Count > 0)
            {
                State.HeadstoneSpawnPoints.Clear();
                State.HeadstoneSpawnPoints.AddRange(newHeadstonePoints);
            }
            State.CreatedHeadstones = false;
        }
Example #2
0
 public override void OnEditorRefresh()
 {
     foreach (Transform child in transform)
     {
         if (child.name.Contains("-STR"))
         {
             //this is our structure template
             State.EntranceStructure.TemplateName = StructureBuilder.GetTemplateName(child.name);
             State.EntranceStructure.Position     = child.localPosition;
             State.EntranceStructure.Rotation     = child.localRotation.eulerAngles;
             UnityEditor.EditorUtility.SetDirty(this);
             UnityEditor.EditorUtility.SetDirty(gameObject);
             break;
         }
     }
 }
Example #3
0
        public override void OnEditorRefresh()
        {
            bool foundStructure = false;

            foreach (Transform child in transform)
            {
                StructureBuilder builder = child.GetComponent <StructureBuilder>();
                if (builder != null)
                {
                    State.DenStructure.TemplateName = StructureBuilder.GetTemplateName(builder.name);
                    State.DenStructure.Position     = child.localPosition;
                    State.DenStructure.Rotation     = child.localRotation.eulerAngles;
                    foundStructure = true;
                    break;
                }
            }
            if (!foundStructure)
            {
                State.DenStructure.TemplateName = string.Empty;
            }
        }
Example #4
0
        public override void OnEditorRefresh()
        {
            State.MinorStructures.Clear();

            List <ActionNode>            nodes = new List <ActionNode> ();
            List <ActionNodePlaceholder> acps  = new List <ActionNodePlaceholder> ();

            ActionNode            node = null;
            ActionNodePlaceholder acp  = null;

            foreach (Transform child in transform)
            {
                if (child.gameObject.HasComponent <StructureBuilder> () || child.name.Contains("-STR"))
                {
                    MinorStructure ms = new MinorStructure();
                    ms.TemplateName = StructureBuilder.GetTemplateName(child.name);
                    ms.Position     = child.transform.localPosition;
                    ms.Rotation     = child.transform.localRotation.eulerAngles;
                    State.MinorStructures.Add(ms);
                }
                else if (child.gameObject.HasComponent <ActionNode> (out node))
                {
                    if (node.State.Users == ActionNodeUsers.AnyOccupant)
                    {
                        nodes.Add(node);
                    }
                }
                else if (child.gameObject.HasComponent <ActionNodePlaceholder> (out acp))
                {
                    if (acp.SaveToStructure)
                    {
                        acps.Add(acp);
                    }
                }
            }

            ActionNodePlaceholder.LinkNodes(acps, nodes, State.MovementNodes);
        }