コード例 #1
0
        // Start is called before the first frame update
        void Start()
        {
            _wantedDirection = transform.forward;
            _rigidbody       = GetComponent <Rigidbody>();
            _selfSettings    = EnemiesManager.Get[tag];
            _selfData        = new EnemiesManager.BoidData()
            {
                position = gameObject.transform.position, forward = gameObject.transform.forward
            };

#if UNITY_EDITOR
            // GIZMOS
            _gizmoDatum = new List <GizmoData>();
#endif // UNITY_EDITOR

            EnemiesManager.Get.AddAgent(this);
        }
コード例 #2
0
    private void OnDrawGizmosSelected()
    {
        Behaviour.EnemiesManager.BoidSettings settings = Behaviour.EnemiesManager.Get?.m_avoidSettings;

        foreach (var avoidData in m_avoidDatum)
        {
            if (settings != null)
            {
                Gizmos.color = settings.m_avoid ? Color.red : Color.green;
                Gizmos.DrawSphere(avoidData.position, settings.m_avoidanceRadius);
                Gizmos.DrawWireSphere(avoidData.position, settings.m_relevantRadius);
            }
            else
            {
                Gizmos.color = Color.yellow;
                Gizmos.DrawSphere(avoidData.position, 15);
            }
            Gizmos.color = Color.magenta;
            Gizmos.DrawLine(avoidData.position, avoidData.position + avoidData.forward * 30);
        }
    }