public override void OnInspectorGUI()
        {
            ICECreatureWaypoint _target = DrawEntityHeader <ICECreatureWaypoint>();

            DrawWaypointContent(_target);
            DrawFooter(_target);
        }
        public virtual void DrawWaypointContent(ICECreatureWaypoint _target)
        {
            if (_target == null)
            {
                return;
            }

            CreatureObjectEditor.DrawWaypointLinksObject(_target, _target.Links, m_HeaderType);
        }
        public override void DrawGizmos(bool _draw)
        {
            if (!_draw || !this.enabled || Entity == null)
            {
                return;
            }

            CustomGizmos.Color(GizmoColor);
            Gizmos.DrawSphere(this.transform.position, GizmoSize);
            //Gizmos.DrawWireCube( this.transform.position, Vector3.one );

            if (Entity.EntityType == ICE.World.EnumTypes.EntityClassType.Waypoint)
            {
                ICECreatureWaypoint _waypoint = Entity as ICECreatureWaypoint;

                if (_waypoint != null && _waypoint.Links.Enabled)
                {
                    foreach (WaypointLinkObject _link in _waypoint.Links.Links)
                    {
                        if (_link.Enabled && _link.Waypoint != null)
                        {
                            float _dist = 0.25f;

                            Vector3 _pos_origin = this.transform.position;
                            Vector3 _pos_target = _link.Waypoint.transform.position;
                            Vector3 _dir        = (_pos_target - _pos_origin).normalized;
                            //_dir.y = 0;
                            Vector3 _rot_dir = _dir;
                            _rot_dir.y = 0;
                            _rot_dir   = Quaternion.Euler(0, 90, 0) * _rot_dir;

                            Gizmos.DrawLine(_pos_origin + (_rot_dir * _dist), _pos_target + (_rot_dir * _dist));
                            //CustomGizmos.Arrow( _pos_origin + ( _rot_dir * _dist ) + ( _dir * 2 ),  _dir );
                            CustomGizmos.ArrowHead(_pos_origin + (_rot_dir * _dist) + (_dir * 1.0f), _dir, _dist * 2, _dist * 100);
                            CustomGizmos.ArrowHead(_pos_origin + (_rot_dir * _dist) + (_dir * 1.5f), _dir, _dist * 2, _dist * 100);
                            CustomGizmos.ArrowHead(_pos_origin + (_rot_dir * _dist) + (_dir * 2.0f), _dir, _dist * 2, _dist * 100);
                            //CustomGizmos.Arrow( 0,  _pos_origin + ( _rot_dir * _dist ) + ( _dir * 1 ), Quaternion.LookRotation( _dir ), _dist * 10 );
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        public WaypointLinkObject(ICEWorldBehaviour _component, GameObject _object) : base(_component)
        {
            if (_object == null)
            {
                return;
            }

            base.Init(_component);

            Enabled = true;

            ICECreatureWaypoint _waypoint = _object.GetComponent <ICECreatureWaypoint>();

            if (_waypoint == null)
            {
                _waypoint = _object.AddComponent <ICECreatureWaypoint>();
            }

            Waypoint = _waypoint;
        }
Ejemplo n.º 5
0
        public ICECreatureWaypoint AddWaypointByObject(GameObject _object)
        {
            if (_object == null || _object == Owner || WaypointExists(_object))
            {
                return(null);
            }

            ICECreatureWaypoint _waypoint = _object.GetComponent <ICECreatureWaypoint>();

            if (_waypoint == null)
            {
                _waypoint = _object.AddComponent <ICECreatureWaypoint>();
            }

            if (_waypoint != null)
            {
                Links.Add(new WaypointLinkObject(OwnerComponent, _object));
            }

            return(_waypoint);
        }
Ejemplo n.º 6
0
        public ICECreatureWaypoint SubdivideLink(WaypointLinkObject _link)
        {
            if (_link == null)
            {
                return(null);
            }

            ICECreatureWaypoint _sub_waypoint = CreateWaypointByPosition(Vector3.Lerp(Owner.transform.position, _link.Waypoint.ObjectTransform.position, 0.5f));

            _sub_waypoint.Links.AddWaypointByObject(Owner);

            ICECreatureWaypoint _link_waypoint = _link.OwnerComponent as ICECreatureWaypoint;

            _sub_waypoint.Links.AddWaypointByObject(_link.Waypoint.gameObject);
            _link_waypoint.Links.AddWaypointByObject(_sub_waypoint.gameObject);

            _sub_waypoint.UseDebug = true;

            _link.Waypoint.Links.RemoveWaypointByObject(Owner);
            RemoveWaypointByObject(_link.Waypoint.gameObject);

            return(_sub_waypoint);
        }