Пример #1
0
    public void AddObstacle(NavMeshObstacle obstacle)
    {
        Vector2 obstacleCenter = new Vector2(obstacle.gameObject.transform.position.x, obstacle.gameObject.transform.position.y);
        Vector3 obstacleSize   = obstacle.gameObject.GetComponent <Renderer>().bounds.size;

        Rect obstacleRect = new Rect(obstacleCenter, obstacleSize);

        Obstacles.Add(obstacleRect);

        BlockedHex.UnionWith(GridHelper.BoxToHexList(obstacleCenter, obstacleSize, NavMap));
    }