示例#1
0
        private void OnDrawGizmos()
        {
            Enable();
            if (_npc.posHolder == null)
            {
                return;
            }

            if (Application.isPlaying == false || _npc.IsCurrentBehaviour(this))
            {
                var positions = new List <Vector3>();
                foreach (GameObject patrolGameObject in _npc.patrolPositions)
                {
                    positions.Add(patrolGameObject.transform.position);
                }

                positions.Add(positions[0]);
                for (var i = 0; i < positions.Count - 1; i++)
                {
                    if (Application.isPlaying && _currentDestination == positions[i + 1])
                    {
                        Gizmos.color = new Color(1f, 0.15f, 0.32f);
                    }
                    else
                    {
                        Gizmos.color = new Color(0.44f, 0.68f, 1f);
                    }
                    Gizmos.DrawLine(positions[i], positions[i + 1]);
                    Vector3 direction = (positions[i] - positions[i + 1]).normalized;
                    Vector3 pos1      = positions[i + 1] + Quaternion.Euler(0, 45, 0) * direction;
                    Vector3 pos2      = positions[i + 1] + Quaternion.Euler(0, -45, 0) * direction;
                    if (Application.isPlaying && _currentDestination == positions[i + 1])
                    {
                        Gizmos.color = new Color(1f, 0.15f, 0.32f);
                    }
                    else
                    {
                        Gizmos.color = Color.white;
                    }
                    Gizmos.DrawLine(positions[i + 1], pos1);
                    Gizmos.DrawLine(positions[i + 1], pos2);
                }
            }
        }
示例#2
0
        private void OnDrawGizmos()
        {
            if (partnerNPC == null)
            {
                return;
            }
            if (!_npc.IsCurrentBehaviour(this) || !_drawGizmos || !partnerNPC.GetComponent <MeetBehaviour>()._drawGizmos)
            {
                return;
            }
            Debug.Log("Draw a gizmos");
            _meetGizmos = new GameObject {
                name = "MeetGizmos"
            };
            Vector3 otherMeetPosition  = partnerNPC.GetComponent <MeetBehaviour>().MeetPosition;
            Vector3 meetGizmosPosition = MeetPosition + (otherMeetPosition - MeetPosition) / 2;

            meetGizmosPosition            += Vector3.up * 0.5f;
            _meetGizmos.transform.position = meetGizmosPosition;
            CustomHierarchy.SetIcon(_meetGizmos, CustomHierarchy.MeetingPointIcon);
            _drawGizmos = false;
            partnerNPC.GetComponent <MeetBehaviour>()._drawGizmos = false;
        }