Пример #1
0
        public override bool OnGUI()
        {
            _action = (HutongGames.PlayMaker.Actions.CircleCast2d)target;

            bool _changed = DrawDefaultInspector();

            if (_changed)
            {
                _action.ComputeRayCastProperties(out _start, out _direction, out _length, out _minDepth, out _maxDepth);
            }



            return(_changed);
        }
Пример #2
0
        public override void OnSceneGUI()
        {
            _action = (HutongGames.PlayMaker.Actions.CircleCast2d)target;

            if (!_action.debug.Value)
            {
                return;
            }

            _action.ComputeRayCastProperties(out _start, out _direction, out _length, out _minDepth, out _maxDepth);

            bool _maxInf = float.IsInfinity(_maxDepth);
            bool _minInf = float.IsNegativeInfinity(_minDepth);

            Handles.color = _action.debugColor.Value;
            _startDepth.x = _start.x;
            _startDepth.y = _start.y;
            _startDepth.z = 0f;
            _direction.Normalize();
            _direction3d.x = _direction.x;
            _direction3d.y = _direction.y;

            _min = -Vector3.forward * 2;
            _max = Vector3.forward * 2;
            float dotSize = 5f;

            Handles.DrawLine(_startDepth, _startDepth + _direction3d * _length);

            if (_maxInf && _minInf)
            {
                startCircle = DrawCapsule2d(_startDepth, _startDepth + _direction3d * _length, _action.radius.Value, 24);
            }

            if (!_maxInf)
            {
                _startDepth.z = _maxDepth;
                startCircle   = DrawCapsule2d(_startDepth, _startDepth + _direction3d * _length, _action.radius.Value, 24);
            }
            if (!_minInf)
            {
                _startDepth.z = _minDepth;
                endCircle     = DrawCapsule2d(_startDepth, _startDepth + _direction3d * _length, _action.radius.Value, 24);
            }


            if (_maxInf && _minInf)
            {
                Handles.DrawDottedLine(startCircle[0] + _min, startCircle[0] + _max, dotSize);
                Handles.DrawDottedLine(startCircle[11] + _min, startCircle[11] + _max, dotSize);
                Handles.DrawDottedLine(startCircle[23] + _min, startCircle[23] + _max, dotSize);
                Handles.DrawDottedLine(startCircle[24] + _min, startCircle[24] + _max, dotSize);
                Handles.DrawDottedLine(startCircle[35] + _min, startCircle[35] + _max, dotSize);
                Handles.DrawDottedLine(startCircle[47] + _min, startCircle[47] + _max, dotSize);
            }
            else if (_maxInf && !_minInf)
            {
                Handles.DrawDottedLine(endCircle[0], endCircle[0] + _max, dotSize);
                Handles.DrawDottedLine(endCircle[11], endCircle[11] + _max, dotSize);
                Handles.DrawDottedLine(endCircle[23], endCircle[23] + _max, dotSize);
                Handles.DrawDottedLine(endCircle[24], endCircle[24] + _max, dotSize);
                Handles.DrawDottedLine(endCircle[35], endCircle[35] + _max, dotSize);
                Handles.DrawDottedLine(endCircle[47], endCircle[47] + _max, dotSize);
            }
            else if (!_maxInf && _minInf)
            {
                Handles.DrawDottedLine(startCircle[0] + _min, startCircle[0], dotSize);
                Handles.DrawDottedLine(startCircle[11] + _min, startCircle[11], dotSize);
                Handles.DrawDottedLine(startCircle[23] + _min, startCircle[23], dotSize);
                Handles.DrawDottedLine(startCircle[24] + _min, startCircle[24], dotSize);
                Handles.DrawDottedLine(startCircle[35] + _min, startCircle[35], dotSize);
                Handles.DrawDottedLine(startCircle[47] + _min, startCircle[47], dotSize);
            }
            else
            {
                Handles.DrawLine(startCircle[0], endCircle[0]);
                Handles.DrawLine(startCircle[11], endCircle[11]);
                Handles.DrawLine(startCircle[23], endCircle[23]);
                Handles.DrawLine(startCircle[24], endCircle[24]);
                Handles.DrawLine(startCircle[35], endCircle[35]);
                Handles.DrawLine(startCircle[47], endCircle[47]);
            }


            /*
             *      startCircle = DrawCapsule2d(_startDepth,_startDepth+_direction3d*_length,_action.radius.Value,24);
             *      Handles.DrawDottedLine(startCircle[0]+_min,startCircle[0]+_max,dotSize);
             *      Handles.DrawDottedLine(startCircle[11]+_min,startCircle[11]+_max,dotSize);
             *      Handles.DrawDottedLine(startCircle[23]+_min,startCircle[23]+_max,dotSize);
             *      Handles.DrawDottedLine(startCircle[24]+_min,startCircle[24]+_max,dotSize);
             *      Handles.DrawDottedLine(startCircle[35]+_min,startCircle[35]+_max,dotSize);
             *      Handles.DrawDottedLine(startCircle[47]+_min,startCircle[47]+_max,dotSize);
             */
        }