void Start()
 {
     sky      = FindObjectOfType <SkyBox>();
     text     = FindObjectOfType <ChangeTextColor>();
     objects  = FindObjectOfType <ObjectManager>();
     modeText = FindObjectOfType <ModeText>();
     SwitchToLight();
 }
Beispiel #2
0
        //This is a console maze generator with a row/length input and  a proability of obstructions
        public string[,] GenerateMaze(int rowLength, int colLength, double probability)
        {
            //"S" is the start position and "E" is the end position
            Random obstructionGen = new Random();

            Random posGen   = new Random();
            int    startPos = posGen.Next(0, rowLength - 1);
            int    endPos   = posGen.Next(0, rowLength - 1);

            string[,] theMazeGen = new string[rowLength, colLength];

            for (int row = 0; row < rowLength; row++)
            {
                for (int col = 0; col < colLength; col++)
                {
                    //Random free space insert
                    Console.OutputEncoding = System.Text.Encoding.UTF8;
                    theMazeGen[row, col]   = "\u25A1";
                    double myObstruction = obstructionGen.NextDouble();
                    if (myObstruction <= probability)
                    {
                        //Random obstruction insert
                        Console.ForegroundColor = ConsoleColor.Red;
                        theMazeGen[row, col]    = "\u25A0";
                        Console.ResetColor();
                    }
                }
            }

            Console.ForegroundColor           = ConsoleColor.Blue;
            theMazeGen[startPos, 0]           = "S";
            theMazeGen[endPos, colLength - 1] = "E";
            Console.ResetColor();

            ChangeTextColor startendText = new ChangeTextColor();

            //Print the array
            for (int row = 0; row < rowLength; row++)
            {
                for (int col = 0; col < colLength; col++)
                {
                    if (theMazeGen[row, col] == "S" || theMazeGen[row, col] == "E")
                    {
                        startendText.PrintColorMessage(ConsoleColor.Blue, theMazeGen[row, col]);
                    }
                    else if (theMazeGen[row, col] == "*")
                    {
                        startendText.PrintColorMessage(ConsoleColor.Red, theMazeGen[row, col]);
                    }
                    else
                    {
                        startendText.PrintColorMessage(ConsoleColor.White, theMazeGen[row, col]);
                    }
                }
                Console.WriteLine();
            }
            return(theMazeGen);
        }
Beispiel #3
0
        /// <summary>
        /// Draw the inspector UI.
        /// </summary>
        public override void OnInspectorGUI()
        {
            EditorGUILayout.Space();

            ChangeTextColor changeTextColorScript = (ChangeTextColor)this.target;

            // Creates the feature header.
            CreateInteractionHeader("CHANGE \nTEXT COLOR", "1.00", "2018");

            // Text
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Target Text", "The text to perform changes"), skin.label);
            changeTextColorScript.TargetText = (Text)EditorGUILayout.ObjectField(
                new GUIContent(""), changeTextColorScript.TargetText, typeof(Text), true);
            EditorGUILayout.EndHorizontal();

            // Color
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Normal Color", "The color of the element when not selected"), skin.label);
            changeTextColorScript.NormalColor = EditorGUILayout.ColorField(new GUIContent(""), changeTextColorScript.NormalColor);
            EditorGUILayout.EndHorizontal();

            // Color
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(new GUIContent("Selected Color", "The color of the element when selected"), skin.label);
            changeTextColorScript.HighlightColor = EditorGUILayout.ColorField(new GUIContent(""), changeTextColorScript.HighlightColor);
            EditorGUILayout.EndHorizontal();

            // Parabolic pointer here
            transitionBool.target = EditorGUILayout.ToggleLeft("Perform Timed Transition", changeTextColorScript.TransitionColor,
                                                               Array.Find(skin.customStyles, element => element.name == Constants.SubtitleGUIStyle));
            changeTextColorScript.TransitionColor = transitionBool.target;

            EditorGUILayout.Space();
            //Extra block that can be toggled on and off.
            if (EditorGUILayout.BeginFadeGroup(transitionBool.faded))
            {
                EditorGUI.indentLevel++;

                // Float
                EditorGUILayout.BeginHorizontal();
                EditorGUILayout.LabelField(new GUIContent("Fade Duration", "How long, in seconds, the fade-in/fade-out animation should take"), skin.label);
                changeTextColorScript.TransitionTime = EditorGUILayout.FloatField(changeTextColorScript.TransitionTime);
                EditorGUILayout.EndHorizontal();

                EditorGUILayout.Space();
                EditorGUI.indentLevel--;
            }
            EditorGUILayout.EndFadeGroup();
            Repaint();
        }