public void DrawGizmos(GizmoManager gizmoManager) { gizmoManager.SetColor(Color.black); for (int i = 0; i < CornerPoints.Length; i++) { Vector2 to = CornerPoints[(i + 1) % CornerPoints.Length]; Vector2 from = CornerPoints[(i) % CornerPoints.Length]; Vector3 to3 = new Vector3(to.x, to.y, 0.0f); Vector3 from3 = new Vector3(from.x, from.y, 0.0f); gizmoManager.DrawLine(from3, to3, 0.1f, "Walls"); } }
void Update() { //Debug GizmoManager.DrawLine(transform.position, transform.position + Vector3.down * distanceToSwitchLand); //Move action if ((state == EnemyState.MOVE) && canMove) { Move(); } //Scan action if (ScanBarrier()) { if (canSwitchLand) { //TODO: left or right var randDirect = Random.Range(0, 100) / 50; MoveAround((MoveAroundDirect)randDirect); } else { //Attack BaseAttack(); } } else { if (state != EnemyState.MOVE && canMove) { state = EnemyState.MOVE; } } //check time attack cooldown if (timeAttack > 0) { timeAttack -= Time.deltaTime; } }