public override float StartBehavior(EnemyController enemyController, Character character) { randomPosition = Random.insideUnitCircle * 1f; randomPosition.Normalize(); randomPosition *= new Vector2(Random.Range(sizeMin.x, sizeMax.x), Random.Range(sizeMin.y, sizeMax.y)); randomPosition = new Vector2(Mathf.Sign(randomPosition.x) * Mathf.Clamp(randomPosition.x, sizeMin.x, sizeMax.x), Mathf.Sign(randomPosition.y) * Mathf.Clamp(randomPosition.y, sizeMin.y, sizeMax.y)); if (nearestSide == true) { character.LookAt(character.Target.transform); randomPosition = new Vector2(Mathf.Abs(randomPosition.x) * -character.GetDirection(), randomPosition.y); } if (lookAtPosition == true) { character.LookAtPosition(randomPosition); } if (targetIsSelf == true) { movementPosition = new Vector3(character.transform.position.x, character.transform.position.y, 0) + randomPosition; } else { movementPosition = new Vector3(character.Target.transform.position.x, character.Target.transform.position.y, 0) + randomPosition; } return(base.StartBehavior(enemyController, character)); }