Example #1
0
        static void SS_CreateSSArea()
        {
            if ((Selection.activeGameObject) == null)
            {
                return;
            }

            bool         isValid = false;
            SS_LevelArea theRect = (Selection.activeGameObject).GetComponent <SS_LevelArea>();

            if (theRect != null)
            {
                isValid = true;
            }

            SS_LevelCanvas theLevel = (Selection.activeGameObject).GetComponent <SS_LevelCanvas>();

            if (theLevel != null)
            {
                isValid = true;
            }

            if (isValid)
            {
                SS_CreateLevelArea(Selection.activeGameObject, "", Random.ColorHSV());
            }
            else
            {
                Debug.Log("Not valid");
            }
        }
Example #2
0
        public static void SS_CreateGridScatters(GameObject theParent)
        {
            bool         isValid = false;
            SS_LevelArea theRect = (Selection.activeGameObject).GetComponent <SS_LevelArea>();

            if (theRect != null)
            {
                isValid = true;
            }

            if (isValid)
            {
                GameObject     newGO  = new GameObject("SS_Scatter");
                SS_GridScatter SSGrid = newGO.AddComponent <SS_GridScatter>();

                SSGrid.thePrefabs = new SS_GridObjects[1];

                SSGrid.thePrefabs[0]           = new SS_GridObjects();
                SSGrid.thePrefabs[0].thePrefab = SS_DefaultScatterPrefab();

                newGO.transform.position = theRect.transform.position;
                newGO.transform.rotation = theRect.transform.rotation;
                newGO.transform.SetParent(theRect.transform);

                theRect.UpdateLevelCanvas();
            }
        }
Example #3
0
        public static void SS_CreateFloor(GameObject theParent)
        {
            bool         isValid = false;
            SS_LevelArea theRect = (theParent).GetComponent <SS_LevelArea>();

            if (theRect != null)
            {
                isValid = true;
            }

            if (isValid)
            {
                GameObject newGO   = new GameObject("SS_Floor");
                SS_Floor   SSFloor = newGO.AddComponent <SS_Floor>();


                SSFloor.thePrefabs = new SS_FloorInstanceObject[1];

                SSFloor.thePrefabs[0]           = new SS_FloorInstanceObject();
                SSFloor.thePrefabs[0].thePrefab = SS_DefaultFloorPrefab();

                //SSFloor.moduleSize = new Vector3(3, 0.25f, 3);

                SSFloor.moduleSize = GetPrefabSize(SSFloor.thePrefabs[0].thePrefab.name, '_');

                newGO.transform.position = theRect.transform.position;
                newGO.transform.rotation = theRect.transform.rotation;
                newGO.transform.SetParent(theRect.transform);

                theRect.UpdateLevelCanvas();
            }
        }
Example #4
0
 /// <summary>
 /// Action that gets called from child elements to update the level canvas hierarchy
 /// </summary>
 public void SetChildrenVisibility(bool newVal)
 {
     for (int i = 0; i < transform.childCount; i++)
     {
         SS_LevelArea theShape = transform.GetChild(i).GetComponent <SS_LevelArea>();
         if (theShape == null)
         {
             transform.GetChild(i).gameObject.SetActive(newVal);
         }
     }
 }
Example #5
0
        bool IsPreviousChildFloor()
        {
            previousSiblingIndex = GetPreviousChildIndex();

            SS_LevelArea theArea = transform.parent.GetChild(previousSiblingIndex).GetComponent <SS_LevelArea>();

            if (theArea.areaType == SS_AreaType.Floor)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Example #6
0
        public static void SS_CreateWall(GameObject theParent)
        {
            bool         isValid = false;
            SS_LevelArea theRect = (theParent).GetComponent <SS_LevelArea>();

            if (theRect != null)
            {
                isValid = true;
            }

            if (isValid)
            {
                GameObject newGO  = new GameObject("SS_Wall");
                SS_Wall    SSWall = newGO.AddComponent <SS_Wall>();


                //Setup Placeholder Wall Prefab
                SSWall.theWallPrefabs              = new SS_WallObjects[1];
                SSWall.theWallPrefabs[0]           = new SS_WallObjects();
                SSWall.theWallPrefabs[0].thePrefab = SS_DefaultWallPrefab();

                // SSWall.moduleSize = new Vector3(3, 0.4f, 3);
                SSWall.moduleSize = GetPrefabSize(SSWall.theWallPrefabs[0].thePrefab.name, '_');


                //Setup Placeholder Corner Prefab

                SSWall.theCornerPrefabs = new SS_CornerObjects[1];

                SSWall.theCornerPrefabs[0] = new SS_CornerObjects();

                SSWall.theCornerPrefabs[0].thePrefab = SS_DefaultCornerPrefab();



                newGO.transform.position = theRect.transform.position;
                newGO.transform.rotation = theRect.transform.rotation;
                newGO.transform.SetParent(theRect.transform);

                theRect.UpdateLevelCanvas();
            }
        }