private static void DrawPointGizmos(SearchingBehavior iSensor, GizmoType iGizmoType) { if (iSensor.SectorLength > 0.0f) { Gizmos.color = iSensor.SectorSenosrColor; Transform aTransform = iSensor.transform; Vector3 aPosition = aTransform.position + Vector3.up * 0.1f; Quaternion aRotation = aTransform.rotation; Vector3 aScale = Vector3.one * iSensor.SectorLength; Mesh aFanMesh = CreateFanMesh(CIRCLE_ANGLE, TRIANGLE_COUNT); if (iSensor.SectorSenosrAngle > 0.0f) { Mesh fanMesh = CreateFanMesh(iSensor.SectorSenosrAngle, TRIANGLE_COUNT); Gizmos.DrawMesh(fanMesh, aPosition, aRotation, aScale); Gizmos.DrawMesh(fanMesh, aPosition, aRotation * Quaternion.AngleAxis(180.0f, Vector3.forward), aScale); } } if (iSensor.NearLength > 0.0f) { Gizmos.color = iSensor.NearSenosrColor; Transform aTransform = iSensor.transform; Vector3 aPosition = aTransform.position + Vector3.up * 0.1f; Quaternion aRotation = aTransform.rotation; Vector3 aScale = Vector3.one * iSensor.NearLength; Mesh aFanMesh = CreateFanMesh(CIRCLE_ANGLE, TRIANGLE_COUNT); Gizmos.DrawMesh(aFanMesh, aPosition, aRotation, aScale); Gizmos.DrawMesh(aFanMesh, aPosition, aRotation * Quaternion.AngleAxis(180.0f, Vector3.forward), aScale); } }
private void Awake() { m_renderer = GetComponentInChildren <Renderer>(); SearchingBehavior searching = GetComponentInChildren <SearchingBehavior>(); searching.onFound += OnFound; searching.onLost += OnLost; }
private static void DrawPointGizmos(SearchingBehavior i_object, GizmoType i_gizmoType) { if (i_object.SearchRadius <= 0.0f) { return; } Gizmos.color = MESH_COLOR; Transform transform = i_object.transform; Vector3 pos = transform.position + Vector3.up * 0.01f; // 0.01fは地面と高さだと見づらいので調整用。 Quaternion rot = transform.rotation; Vector3 scale = Vector3.one * i_object.SearchRadius; if (i_object.SearchAngle > 0.0f) { Mesh fanMesh = CreateFanMesh(i_object.SearchAngle, TRIANGLE_COUNT); Gizmos.DrawMesh(fanMesh, pos, rot, scale); } }
void Init() { p_TimeGage = GameObject.Find("TimeGage").GetComponent <TimeGage>(); PlayerDamage = GameObject.Find("Damage"); EnemyInit(); if (GetComponent <NavMeshAgent>() != null && LTarget.Count > 0) //NavMeshがあれば { isTarget = new bool[LTarget.Count]; //ターゲット分フラグの配列を大きくする int nextTarget = Random.Range(0, LTarget.Count); //次に行く場所をランダムで決める isTarget[nextTarget] = true; //フラグをON agent = GetComponent <NavMeshAgent>(); } TakeOverControl(); if (isAIEnemy == true) { SearchingBehavior searching = GetComponentInChildren <SearchingBehavior>(); searching.onFound += OnFound; searching.onLost += OnLost; } isInit = true; }