Ejemplo n.º 1
0
        private void AllPathUI()
        {
            if (!eTarget)
            {
                return;
            }

            for (int i = 0; i < eTarget.Paths.Count; i++)
            {
                UF_PathModeSelector _p          = eTarget.Paths[i];
                UF_PathMode         _pathMethod = _p.Mode;
                EditoolsLayout.Foldout(ref _pathMethod.ShowPath, $"Show/Hide {_pathMethod.Id}", true);

                if (!_pathMethod.ShowPath)
                {
                    continue;
                }

                EditoolsBox.HelpBox($"[{i}] {_pathMethod.Id} -> {_pathMethod.PathPoints.Count} total points");

                EditoolsLayout.Horizontal(true);
                EditoolsButton.ButtonWithConfirm("Remove This Path", Color.red, eTarget.RemovePath, i,
                                                 $"Suppress Path {i + 1} ? ", "Are your sure ?");

                UF_PathModeSelector _mode = _p;
                _mode.Type = (UF_PathType)EditoolsField.EnumPopup("Mode Type", _mode.Type);
                EditoolsLayout.Horizontal(false);

                _mode.Mode.DrawSettings();

                EditoolsLayout.Space(5);
            }
        }
Ejemplo n.º 2
0
    void DrawnSpawnPointsUI()
    {
        EditoolsLayout.Horizontal(true);
        EditoolsBox.HelpBoxInfo("Add Spawn Point");

        EditoolsLayout.Vertical(true);
        EditoolsButton.Button("+", Color.green, eTarget.AddPoint);
        EditoolsButton.ButtonWithConfirm("Clear Points", Color.red, eTarget.Clear, "Remove All ?", "Remove All Point ?", _showCondition: eTarget.SpawnPoints.Count > 0);
        EditoolsLayout.Vertical(false);

        EditoolsLayout.Horizontal(false);


        EditoolsLayout.Space(2);

        for (int i = 0; i < eTarget.SpawnPoints.Count; i++)
        {
            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBox($"SpawnPoint {i+1}");
            EditoolsButton.ButtonWithConfirm("X", Color.red, eTarget.Remove, i, "Remove Point ?", "Remove This Point ?");

            EditoolsLayout.Horizontal(false);

            if (i > eTarget.SpawnPoints.Count - 1)
            {
                return;
            }

            SM_SpawnPoint _point = eTarget.SpawnPoints[i];
            EditoolsLayout.Foldout(ref _point.IsVisible, "Show/Hide");

            if (!_point.IsVisible)
            {
                continue;
            }

            EditoolsField.Vector3Field("Position", ref _point.Position);
            EditoolsField.Vector3Field("Size", ref _point.Size);

            EditoolsField.Toggle("Use Delay ?", ref _point.UseDelay);
            if (_point.UseDelay)
            {
                _point.SpawnDelay = EditorGUILayout.Slider("Spawn Delay", _point.SpawnDelay, 0, 15);
            }
            else
            {
                _point.SpawnDelay = 0;
            }

            EditoolsField.Toggle("Use Trigger ?", ref _point.UseTrigger);

            EditoolsLayout.Space();

            EditoolsLayout.Space(1);

            DrawSpawnModeUI(_point);

            DrawnAgentUI(_point);
        }
    }
Ejemplo n.º 3
0
        public override void OnInspectorGUI()
        {
            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBoxInfo("Agents Settings");
            EditoolsLayout.Horizontal(false);

            EditoolsLayout.Space(2);

            EditoolsLayout.Horizontal(true);
            targetSettings.SpeedMove = EditoolsField.FloatField("Move Speed", targetSettings.SpeedMove);
            EditoolsLayout.Horizontal(false);

            EditoolsLayout.Horizontal(true);
            targetSettings.SpeedRotation = EditoolsField.FloatField("Rotation Speed", targetSettings.SpeedRotation);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Horizontal(true);
            EditoolsField.Toggle("Add LookAt ?", ref targetSettings.UseLookAt);
            EditoolsLayout.Horizontal(false);
            EditoolsLayout.Horizontal(true);
            if (targetSettings.UseLookAt)
            {
                EditoolsBox.HelpBox("LookAt Target");
                targetSettings.TargetLookAt = (GameObject)EditoolsField.ObjectField(targetSettings.TargetLookAt, typeof(GameObject), true);
            }
            EditoolsLayout.Horizontal(false);


            EditorUtility.SetDirty(targetSettings); // flush value
        }
Ejemplo n.º 4
0
 public override void DrawSettings()
 {
     //Radius = EditorGUILayout.IntSlider("Radius", Radius, 1, 100);
     //AgentNumber = EditorGUILayout.IntSlider("Radius", AgentNumber, 1, 100);
     EditoolsField.IntSlider("Radius", ref Radius, 1, 100);
     EditoolsField.IntSlider("Agent Number", ref AgentNumber, 1, 50);
 }
Ejemplo n.º 5
0
    void DrawnAgentUI(SM_SpawnPoint _point)
    {
        EditoolsField.Toggle("Unique Agent? ", ref _point.IsMonoAgent);
        EditoolsLayout.Space(5);

        if (_point.IsMonoAgent)
        {
            EditoolsLayout.Horizontal(true);
            _point.MonoAgent = (GameObject)EditoolsField.ObjectField(_point.MonoAgent, typeof(GameObject), false);
            EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveAgent, "Remove Agent", "Remove Agent?");
            EditoolsLayout.Horizontal(false);
        }
        else
        {
            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBoxInfo($"Add agent to spawn");
            EditoolsLayout.Vertical(true);
            EditoolsButton.Button("Add Agent", Color.cyan, _point.AddAgent);
            EditoolsButton.ButtonWithConfirm("Clear", Color.red, _point.ClearAgents, "Clear Agents", "Clear All Agents ?",
                                             _showCondition: _point.Agents.Count > 0);
            EditoolsLayout.Vertical(false);
            EditoolsLayout.Horizontal(false);

            for (int j = 0; j < _point.Agents.Count; j++)
            {
                EditoolsLayout.Horizontal(true);
                _point.Agents[j] = (GameObject)EditoolsField.ObjectField(_point.Agents[j], typeof(GameObject), false);
                EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveAgent, j, "Remove Agent ?",
                                                 "Remove This Agent ?");
                EditoolsLayout.Horizontal(false);
            }
        }
    }
Ejemplo n.º 6
0
        public override void DrawSettings()
        {
            EditoolsLayout.Space(3);

            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBox($"Path ID : {Id}");
            EditoolsField.TextField("", ref Id);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBoxInfo("Line Settings");
            EditoolsLayout.Vertical(true);
            EditoolsButton.ButtonWithConfirm("Remove All Points", Color.red, Path.ClearPoints, $"Suppress All Points ? ", "Are your sure ?", "Yes", "No", Path.PathPoints.Count > 0);
            EditoolsButton.Button("Add Point", Color.green, Path.AddPoint);
            EditoolsLayout.Vertical(false);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBox("Path Color");
            EditoolsField.ColorField(PathColor, ref PathColor);
            EditoolsLayout.Horizontal(false);

            // New Line


            ShowPathPointUi(Path);
            EditoolsField.IntSlider("Start at percent ", ref currentPercent, 0, 100);

            if (GUI.changed)
            {
                SceneView.RepaintAll();
            }
        }
    private void ShowPathPointUi(PE_Path _path)
    {
        if (_path.PathPoints.Count == 0)
        {
            return;
        }
        EditoolsLayout.Foldout(ref _path.ShowPoint, $"Show/Hide points {_path.Id}", true);
        if (_path.ShowPoint)
        {
            for (int i = 0; i < _path.PathPoints.Count; i++)
            {
                EditoolsLayout.Horizontal(true);

                _path.PathPoints[i] = EditoolsField.Vector3Field($"Path Point [{i + 1}]", _path.PathPoints[i]);
                EditoolsButton.ButtonWithConfirm("-", Color.magenta, _path.RemovePoint, i,
                                                 $"Suppress Point {i + 1} at {_path.PathPoints[i]} ? ", "Are your sure ?");

                EditoolsLayout.Horizontal(false);
            }
        }

        EditoolsLayout.Space(1);

        if (_path.PathPoints.Count > 0)
        {
            EditoolsButton.ButtonWithConfirm("Remove All Points", Color.red, _path.ClearPoints, $"Suppress All Points ? ",
                                             "Are your sure ?");
        }
    }
Ejemplo n.º 8
0
 public override void DrawSettings()
 {
     EditoolsField.Toggle("Auto Destroy Agents ?", ref AutoDestroyAgent);
     if (AutoDestroyAgent)
     {
         AutoDestroyDelay = EditorGUILayout.Slider("Auto Destroy Delay", AutoDestroyDelay, 0, 15);
     }
 }
Ejemplo n.º 9
0
    public override void DrawSettings()
    {
        EditoolsField.IntSlider("Agent Number", ref AgentNumber, 1, 100);
        EndPosition = EditoolsField.Vector3Field("End Position", EndPosition);
        Position    = EditoolsField.Vector3Field("Start Position", Position);

        EditoolsField.Toggle("Auto Destroy Agents ?", ref AutoDestroyAgent);
        if (AutoDestroyAgent)
        {
            AutoDestroyDelay = EditorGUILayout.Slider("Auto Destroy Delay", AutoDestroyDelay, 0, 15);
        }
    }
Ejemplo n.º 10
0
    public override void DrawSettings()
    {
        //Radius = EditorGUILayout.IntSlider("Radius", Radius, 1, 100);
        //AgentNumber = EditorGUILayout.IntSlider("Radius", AgentNumber, 1, 100);
        EditoolsField.IntSlider("Radius", ref Radius, 1, 100);
        EditoolsField.IntSlider("Agent Number", ref AgentNumber, 1, 50);

        EditoolsField.Toggle("Auto Destroy Agents ?", ref AutoDestroyAgent);
        if (AutoDestroyAgent)
        {
            AutoDestroyDelay = EditorGUILayout.Slider("Auto Destroy Delay", AutoDestroyDelay, 0, 15);
        }
    }
Ejemplo n.º 11
0
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();
        EditoolsBox.HelpBoxInfo($"SPAWN TOOL V{version}");
        eTarget.TriggerZonePrefab = (SM_SpawnTrigger)EditoolsField.ObjectField(eTarget.TriggerZonePrefab, typeof(SM_SpawnTrigger), false);
        if (!eTarget.TriggerZonePrefab)
        {
            return;
        }

        EditoolsLayout.Space(1);
        DrawnSpawnPointsUI();

        SceneView.RepaintAll();
    }
Ejemplo n.º 12
0
        public override void DrawSettings()
        {
            if (!IsValid)
            {
                return;
            }
            EditoolsLayout.Space(3);

            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBox($"Path ID : {Id}");
            EditoolsField.TextField("", ref Id);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBoxInfo("Curve Settings");
            EditoolsLayout.Vertical(true);
            EditoolsButton.ButtonWithConfirm("Reset Curve", Color.red, Curve.ResetCurve, "Reset Curve ?",
                                             $"Remove Curve", "Are your sure ?", _showCondition: !Curve.IsEmpty);
            EditoolsButton.Button("Add Segment", Color.green, Curve.AddSegment);
            EditoolsLayout.Vertical(false);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBox("Curve Color");
            EditoolsField.ColorField(PathColor, ref PathColor);
            EditoolsLayout.Horizontal(false);


            EditoolsLayout.Space(2);

            EditoolsField.IntSlider("Start at percent ", ref Curve.CurrentPercent, 0, 100);
            EditoolsField.IntSlider("Curve Definition", ref Curve.CurveDefinition, Curve.MinDefinition,
                                    Curve.MaxDefinition);

            EditoolsLayout.Space(2);

            DisplaySegmentSettings();

            if (GUI.changed)
            {
                Curve.SetCurve();
                SceneView.RepaintAll();
            }
        }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        EditoolsBox.HelpBoxInfo($"Terrain generator build : {eTarget.Version}");

        GUILayout.Label("Initials corner value for heightmap generation");
        EditoolsField.FloatField("Up Left", ref eTarget.cornerUpLeft);
        EditoolsField.FloatField("Up Right", ref eTarget.cornerUpRight);
        EditoolsField.FloatField("Down Left", ref eTarget.cornerDownLeft);
        EditoolsField.FloatField("Down Right", ref eTarget.cornerDownRight);

        EditoolsBox.HelpBoxInfo("The map size will be of equation 2 ^ power + 1");
        EditoolsField.IntField("power", ref eTarget.power);

        EditoolsField.IntField("Random range", ref eTarget.randomRange);

        EditoolsLayout.Space();
        GUILayout.Label("Rasterization settings : ");
        EditoolsField.Toggle("Use min and max value", ref eTarget.useMinMax);
        EditoolsField.FloatField("Maximum value", ref eTarget.maxValue);
        EditoolsField.FloatField("Minimum value", ref eTarget.minValue);
        EditoolsLayout.Space();


        /*EditoolsLayout.Space();
        *  EditoolsButton.Button("Generate Height map", Color.white, GenerateHeightMap);
        *  EditoolsLayout.Space();*/

        EditoolsLayout.Space();
        EditoolsButton.Button("Create Map", Color.white, CreateMap);
        EditoolsLayout.Space();

        displayArray = EditoolsLayout.Foldout(displayArray, "Heightmap Content");
        if (displayArray)
        {
            if (eTarget.heightMap == null)
            {
                EditoolsBox.HelpBoxError("No valid heightmap");
            }
            else
            {
                DisplayTwoDimentionalArray(eTarget.heightMap);
            }
        }
    }
Ejemplo n.º 14
0
        private void ShowPathPointUi(UF_PathLine _path)
        {
            if (_path.PathPoints.Count == 0)
            {
                return;
            }
            EditoolsLayout.Foldout(ref _path.ShowPoint, $"Show/Hide points {Id}", true);
            if (_path.ShowPoint)
            {
                for (int i = 0; i < _path.PathPoints.Count; i++)
                {
                    EditoolsLayout.Horizontal(true);
                    EditoolsButton.ButtonWithConfirm("-", Color.red, _path.RemovePoint, i, $"Suppress Point {i + 1} at {_path.PathPoints[i]} ? ", "Are your sure ?");
                    EditoolsBox.HelpBox($"[{i + 1} / {_path.PathPoints.Count}]");
                    _path.PathPoints[i] = EditoolsField.Vector3Field("", _path.PathPoints[i]);

                    EditoolsLayout.Horizontal(false);
                }
            }
        }
    private void AllPathUI()
    {
        if (!eTarget)
        {
            return;
        }

        for (int i = 0; i < eTarget.Paths.Count; i++)
        {
            PE_Path _p = eTarget.Paths[i];
            EditoolsLayout.Foldout(ref _p.ShowPath, $"Show/Hide {_p.Id}", true);

            if (!_p.ShowPath)
            {
                continue;
            }

            EditoolsBox.HelpBox($"[{i}] {_p.Id} -> {_p.PathPoints.Count} total points");

            EditoolsLayout.Horizontal(true);

            EditoolsButton.ButtonWithConfirm("Remove This Path", Color.red, eTarget.RemovePath, i, $"Suppress Path {i + 1} ? ",
                                             "Are your sure ?");

            EditoolsButton.Button("+", Color.green, _p.AddPoint);
            EditoolsButton.Button("Editable", _p.IsEditable ? Color.green : Color.grey, SetActiveEdition, _p);
            EditoolsLayout.Horizontal(false);

            // New Line
            EditoolsLayout.Horizontal(true);
            EditoolsField.TextField(_p.Id, ref _p.Id);
            EditoolsField.ColorField(_p.PathColor, ref _p.PathColor);


            EditoolsLayout.Horizontal(false);

            ShowPathPointUi(_p);
            EditoolsLayout.Space(5);
        }
    }
    void DrawSpawnModeUI(SM_SpawnPoint _point)
    {
        EditoolsLayout.Horizontal(true);
        EditoolsBox.HelpBoxInfo("Add Spawn Mode");

        EditoolsLayout.Vertical(true);
        EditoolsButton.Button("+", Color.green, _point.AddMode);
        EditoolsButton.ButtonWithConfirm("#", Color.red, _point.ClearModes, "Remove All ?", "Remove All Mode ?", _showCondition: _point.SpawnModes.Count > 0);
        EditoolsLayout.Vertical(false);

        EditoolsLayout.Horizontal(false);
        for (int i = 0; i < _point.SpawnModes.Count; i++)
        {
            SM_SpawnMode _mode = _point.SpawnModes[i];

            EditoolsLayout.Horizontal(true);
            _mode.Type = (SM_SpawnType)EditoolsField.EnumPopup("Mode Type", _mode.Type);
            EditoolsButton.ButtonWithConfirm("X", Color.red, _point.RemoveMode, i, "Remove Mode ?", "Remove This Mode ?");
            EditoolsLayout.Horizontal(false);
            DrawModeSettingsUI(_mode);
        }
    }
Ejemplo n.º 17
0
 public override void DrawSettings()
 {
     EditoolsField.IntSlider("Agent Number", ref AgentNumber, 1, 100);
     EndPosition = EditoolsField.Vector3Field("End Position", EndPosition);
     Position    = EditoolsField.Vector3Field("Start Position", Position);
 }
Ejemplo n.º 18
0
        void DrawnAgentUI()
        {
            if (!eTarget)
            {
                return;
            }

            EditoolsLayout.Horizontal(true);
            EditoolsBox.HelpBoxInfo("Agents Settings");
            EditoolsLayout.Vertical(true);
            EditoolsButton.ButtonWithConfirm("Remove all Agents", Color.red, eTarget.ClearAgents, "Clear All Agents ?",
                                             $"Clear All Agents", "Are your sure ?", _showCondition: eTarget.Agents.Count > 0);
            EditoolsButton.Button("Add Agent", Color.green, eTarget.AddAgent);
            EditoolsLayout.Vertical(false);
            EditoolsLayout.Horizontal(false);

            for (int i = 0; i < eTarget.Agents.Count; i++)
            {
                if (eTarget.Agents[i] == null)
                {
                    return;
                }
                UF_PathAgent _agent = eTarget.Agents[i];
                EditoolsLayout.Foldout(ref _agent.Show, $"{i + 1} / {eTarget.Agents.Count}");

                if (!_agent.Show)
                {
                    continue;
                }

                EditoolsLayout.Horizontal(true);
                EditoolsBox.HelpBox($"{i + 1} / {eTarget.Agents.Count}");
                EditoolsButton.ButtonWithConfirm("-", Color.red, eTarget.RemoveAgent, i, $"Remove Agent {i}",
                                                 "Are your sure ?");
                EditoolsLayout.Horizontal(false);

                // EditoolsField.IntSlider("Speed Move", ref _agent.SpeedMove, _agent.MinSpeedMove, _agent.MaxSpeedMove); // todo remove
                // EditoolsField.IntSlider("Speed Rotation", ref _agent.SpeedRotation, _agent.MinSpeedRotation _agent.MaxSpeedRotation); // todo remove

                EditoolsLayout.Horizontal(true);
                _agent.AgentToMove =
                    (GameObject)EditoolsField.ObjectField(_agent.AgentToMove, typeof(GameObject), true);
                // todo input for UF_PAthAgentSettings
                _agent.AgentSettings =
                    (UF_PathAgentSettings)EditoolsField.ObjectField(_agent.AgentSettings, typeof(UF_PathAgentSettings),
                                                                    false);
                EditoolsButton.Button("New Settings", Color.white, PathManagerMenu.UF_PathManagerMenu.CreateNewAgentProfile, !_agent.AgentSettings);
                EditoolsLayout.Horizontal(false);

                if (eTarget.Paths.Count > 0)
                {
                    string[] _pathsNames = eTarget.Paths.Select(o => o.Mode.Id).ToArray();
                    _agent.PathIndex = EditorGUILayout.Popup("Paths target", _agent.PathIndex, _pathsNames);
                    _agent.PathId    = _pathsNames[_agent.PathIndex];
                }
                else
                {
                    EditoolsBox.HelpBox("NO PATH FOUND !", MessageType.Error);
                }
            }
        }