Ejemplo n.º 1
0
        private void OnDrawGizmos()
        {
            if (Astronomy.SunLight == null)
            {
                return;
            }

            if (!Application.isPlaying)
            {
                Astronomy.SunLight.transform.localRotation = Astronomy.Rotation();
            }

            Gizmos.color = Color.blue;
            Gizmos.DrawLine(Astronomy.SunLight.transform.position + (Astronomy.SunLight.transform.forward * Astronomy.Radius * 0.75f), Astronomy.SunLight.transform.position + (Astronomy.SunLight.transform.forward * Astronomy.Radius));
            //Gizmos.DrawLine( Sun.transform.position - ( Sun.transform.forward * Radius * 0.75f ), Sun.transform.position - ( Sun.transform.forward * Radius ) );
            CustomGizmos.Circle(Astronomy.SunLight.transform.position, Astronomy.SunLight.transform.up, Astronomy.Radius);
            CustomGizmos.Arrow(Astronomy.SunLight.transform.position + (Astronomy.SunLight.transform.forward * Astronomy.Radius * 0.75f), Astronomy.SunLight.transform.forward * -2, 10);
            CustomGizmos.HandlesColor(Gizmos.color);
            CustomGizmos.Arrow(0, Astronomy.SunLight.transform.position - (Astronomy.SunLight.transform.forward * Astronomy.Radius), Astronomy.SunLight.transform.rotation, 50);


            if (m_PathPositions.Count > 1000)
            {
                m_PathPositions.RemoveAt(0);
            }

            Vector3 _prior_pos = Vector3.zero;

            foreach (Vector3 _pos in m_PathPositions)
            {
                if (_prior_pos != Vector3.zero)
                {
                    Gizmos.DrawLine(_prior_pos, _pos);
                }

                _prior_pos = _pos;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Draws the interaction.
        /// </summary>
        public void DrawInteraction()
        {
            if (CreatureControl.Creature.Interaction.Interactors.Count == 0 || ShowInteractor == false)
            {
                return;
            }

            for (int i = 0; i < CreatureControl.Creature.Interaction.Interactors.Count; i++)
            {
                InteractorObject _interactor = CreatureControl.Creature.Interaction.Interactors[i];

                if (!_interactor.Enabled)
                {
                    continue;
                }

                List <GameObject> _target_game_objects = GetCreaturesByName(_interactor.Name);

                if (_target_game_objects != null && _target_game_objects.Count > 0)
                {
                    foreach (GameObject _target_game_object in _target_game_objects)
                    {
                        Vector3 _interactor_pos = _target_game_object.transform.position;

                        TargetObject _target = new TargetObject(TargetType.INTERACTOR);

                        _target.TargetGameObject = _target_game_object;
                        _target.BehaviourModeKey = _interactor.BehaviourModeKey;
                        _target.Selectors.Copy(_interactor.Selectors);
                        _target.UpdateOffset(_interactor.DefaultOffset);
                        _target.TargetStopDistance          = _interactor.DefaultStopDistance;
                        _target.TargetRandomRange           = _interactor.DefaultRandomRange;
                        _target.TargetSmoothingMultiplier   = 0;                      //_interactor.DefaultSmoothingMultiplier; // TODO:REWORK TargetSmoothingMultiplier
                        _target.TargetIgnoreLevelDifference = _interactor.DefaultIgnoreLevelDifference;

                        DrawTargetGizmos(_target);

                        // DIRECTION
                        CustomGizmos.Arrow(_target.TargetPosition, _target.TargetDirection * _target.TargetStopDistance, 0.5f, 20);

                        Vector3 _last_move_position = _target.TargetMovePosition;
                        float   _last_stop_distance = _target.TargetStopDistance;

                        _last_move_position.y = GetLevel();

                        Color _default_color = Gizmos.color;
                        Color _target_color  = (_target.Active?ActiveTargetColor:TargetColor);

                        foreach (InteractorRuleObject _rule in _interactor.Rules)
                        {
                            if (!_rule.Enabled)
                            {
                                continue;
                            }

                            _target = new TargetObject(TargetType.INTERACTOR);

                            _target.TargetGameObject = _target_game_object;
                            _target.BehaviourModeKey = _rule.BehaviourModeKey;
                            _target.Selectors.Copy(_rule.Selectors);

                            _target.UpdateOffset(_interactor.DefaultOffset);
                            _target.TargetStopDistance          = _interactor.DefaultStopDistance;
                            _target.TargetRandomRange           = _interactor.DefaultRandomRange;
                            _target.TargetSmoothingMultiplier   = 0;                          //_interactor.DefaultSmoothingMultiplier; // TODO:REWORK TargetSmoothingMultiplier
                            _target.TargetIgnoreLevelDifference = _interactor.DefaultIgnoreLevelDifference;

                            if (_rule.OverrideTargetMovePosition)
                            {
                                _target.UpdateOffset(_rule.Offset);
                                _target.TargetStopDistance          = _rule.StopDistance;
                                _target.TargetRandomRange           = _rule.RandomRange;
                                _target.TargetSmoothingMultiplier   = 0;
                                _target.TargetIgnoreLevelDifference = _rule.IgnoreLevelDifference;
                            }

                            DrawTargetGizmos(_target);

                            Vector3 _move_position = _target.TargetMovePosition;
                            _move_position.y = GetLevel();

                            Gizmos.color = _target_color;
                            if (_last_move_position != Vector3.zero)
                            {
                                CustomGizmos.OffsetPath(_last_move_position, _last_stop_distance, _move_position, _target.TargetStopDistance, true);
                            }

                            _last_stop_distance = _target.TargetStopDistance;
                            _last_move_position = _move_position;
                        }

                        Gizmos.color = _target_color;
                        if (_last_move_position != Vector3.zero)
                        {
                            CustomGizmos.OffsetPath(_last_move_position, _last_stop_distance, _interactor_pos, 0, false);
                        }

                        Gizmos.color = _default_color;
                        //CustomGizmos.OffsetPath( _default_data.OffsetPosition, _default_data.StopDistance, _interactor_pos, 0 );
                    }
                }
            }
        }